Re: MySql, PHP, and Dates

From: Date: Sun, 30 Mar 2003 03:11:29 +0000
Subject: Re: MySql, PHP, and Dates
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-26714@lists.php.net to get a copy of this message
I originally wrote:
when I retrieve a date from MySQL into PHP, it shows up as a string instead of a date data type
What's the best way of controlling date format?
John W. Holmes replied:
If you want a Unix timestamp, which is compatible with the date() function in PHP, then use the UNIX_TIMESTAMP() function in your SQL.
This seems to be the ideal solution. Thanks, John, and also those of you who responded via private e-mail. I wonder why the PHP/MySql interface doesn't simply return dates as dates instead of strings. *frowns* Bruce Feist

« previous php.db (#26714) next »