Date/Time Formatting

From: Date: Fri, 19 Jan 2001 03:29:47 +0000
Subject: Date/Time Formatting
Groups: php.general 
Request: Send a blank email to php-general+get-35628@lists.php.net to get a copy of this message
I'm fairly new to SQL and PHP and I'm haveing trouble useing the Date functions of Both Systems, so I'd be greatfull if someone can help. What I'm trying to do is have an 'administrator' be able to enter info through a form to a mySQL database. Then on a seperate page have the info reread and displayed. The basic outline is a News page which reads and displays from the table and shows the News topics preceeding and inculding the current date (ie if I enter a future Date eg 25/12/2001 and the comment Merry christmas, in the databaes I don't want it to appear until the date has occured) The Table looks as follows: CREATE TABLE news ( news_id INT NOT NULL primary key auto_increment, topic VARCHAR(30) NOT NULL, live_date date NOT NULL, news BLOB NOT NULL, user_id VARCHAR(20) NOT NULL); I've used the MYSQL date type as I think this would be easier for the users to be able to manually enter the date in is form on the admin form - also I don't think a more accurate date/time method will be more usful. Currently I'm using this SQL Line: SELECT * FROM news ORDER BY live_date DESC LIMIT 4 (where Live_Date is the date to display the news after) Also I'd like to if possible to be able to enter and display the date in Australian / European Time format (DD,MM,YYYY) I'm currently entering it on the form using three text fields and then rearanging them to the Format in mySQL and indserting it as a string, but I don't know how to 'break' up a mySQL Date value to rearange it. Hope these arn't in the FAQ as I have spent some time looking through PHP script sites and have been unable to find anything that can help.

« previous php.general (#35628) next »