Re: PHP/MySQL -- Date/Time Confusion

From: Date: Fri, 12 Jul 2002 21:15:15 +0000
Subject: Re: PHP/MySQL -- Date/Time Confusion
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-107435@lists.php.net to get a copy of this message
You've got all kinds of options. I suggest you do any date calculations in the database and use DATE_FORMAT to format any dates pulled out. It's exactly like the date() function in PHP. MySQL has some great date and time functions so you can select out exactly what you want. You can use the UNIXTIME() (I think that's the function) function, too, to convert the MySQL timestamp to a unix timestamp. It's all in the MySQL manual, chapter 6, Date and Time Functions. ---John Holmes... ----- Original Message ----- From: "Monty" <monty3@hotmail.com> To: <php-general@lists.php.net> Sent: Friday, July 12, 2002 5:06 PM Subject: [PHP] PHP/MySQL -- Date/Time Confusion > Which method is the best way to store date/time in MySQL and then which PHP > command is the best to use to convert that date to something useful? I'm > having a difficult time figuring out how to reconcile the date in MySQL so > it works with PHP's various date commands, like getdate(). > > Any suggestions? I'll mostly need to compared dates/times of different > records and then extract parts of the date for displaying on the screen. > > Thanks! > > Monty > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#107435) next »