RE: [PHP] Re[2]: [PHP-DB] mysql timestamps
| From: | John W. Holmes | Date: | Mon, 24 Mar 2003 13:22:30 +0000 |
| Subject: | RE: [PHP] Re[2]: [PHP-DB] mysql timestamps | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-140846@lists.php.net to get a copy of this message | ||
Yeah, sorry, it's the UNIX_TIMESTAMP() function you want.
FROM_UNIXTIME() will convert a Unix timestamp to a MySQL timestamp,
also.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
> -----Original Message-----
> From: Don Read [mailto:dread@texas.net]
> Sent: Monday, March 24, 2003 4:30 AM
> To: L0vCh1Y
> Cc: php-general@lists.php.net
> Subject: RE: [PHP] Re[2]: [PHP-DB] mysql timestamps
>
>
> On 24-Mar-2003 L0vCh1Y wrote:
> >
> >
> > JWH> SELECT TO_UNIXTIME(your_column) FROM table ...
> >
> >
> > It doesn't work... MySQL returns error - what could be trouble in? I
> > also tried
> >
> > SELECT TO_UNIXTIME(foo) AS bar FROM baz
> >
> > But it's look like it doesn't know such function :\.
> >
> > I tried table in next types: TIMESTAMP,DATETIME.
> >
> >
>
> There's no such function in MySQL but there is UNIX_TIMESTAMP():
>
> localhost.dread$ grep TO_UNIXTIME $MANUAL
> localhost.dread$ grep UNIX_TIMESTAMP $MANUAL
>
RAND()'. You can, for example, use
> UNIX_TIMESTAMP()' for the
> `UNIX_TIMESTAMP()'. Other functions operate on the formatted
> `UNIX_TIMESTAMP()'
> `UNIX_TIMESTAMP(date)'
> UNIX_TIMESTAMP()' is called with a date'
> argument, it returns
>
> <snip>
>
> --
> Don Read dread@texas.net
> -- It's always darkest before the dawn. So if you are going to
> steal the neighbor's newspaper, that's the time to do it.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php