RE: [PHP] Re: datetime convert
| From: | John Holmes | Date: | Sat, 14 Sep 2002 14:27:05 +0000 |
| Subject: | RE: [PHP] Re: datetime convert | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-116370@lists.php.net to get a copy of this message | ||
> > I'm trying to convert a formated datetime string into a timestamp.
> > The string format is "Y-m-d H:i:s". I use strtotime() to convert the
> > datetime string. However, the converted datetime seems lost its
> > time part. Is there any easy solution to make the converting?
> > Thanks in advance!
If that date is coming from MySQL, use UNIX_TIMESTAMP() in your query to
pull it out as a unix timestamp instead of the MySQL format. You may
also want to look at the DATE_FORMAT() function, similar to the date()
function in PHP.
---John Holmes...