Re: Time/date function MYSQL->UNIX
| From: | Hugh Bothwell | Date: | Fri, 24 May 2002 21:14:24 +0000 |
| Subject: | Re: Time/date function MYSQL->UNIX | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-99159@lists.php.net to get a copy of this message | ||
"Peter" <newsaddress@saracenvsu.org.uk> wrote in message
news:20020524210625.14400.qmail@pb1.pair.com...
> Is there a built in PHP function which will convert a MySQL type date
> (YYYYDDMM or whatever) into a unix timestamp so it can be used with the
> other PHP time and date functions?
>
> I'm currently using substr() to extract bits of the date so it displays as
> DD / MM / YYYY but it's annoying!
SELECT
id, UNIX_TIMESTAMP(mydate) AS mydatestamp
FROM mytable
then $row['mydatestamp'] is your unix timestamp.