RE: [PHP-DB] Date weirdness (php/mysql) (code included) From: John Guynn (John.Guynn <email protected>)
Date: 11/08/00

After a little digging around on the
http://www.php.net/manual/function.mktime.php and
http://www.php.net/manual/function.strtotime.php pages I came across a
solution I can deal with.

$fmtdate = ereg_replace('([0-9]*)-([0-9]*)-([0-9]*)','\2/\3/\1',
$row[thedate]); (format the date in a way that strtotime() can deal with it)

$timestamp = strtotime($fmtdate); (build the timestamp with strtotime())

For some reason this seemed easier than the mktime() method.

Either way it worked and I appreciate Rasmus pointing me in the right
direction.

John Guynn

-----Original Message-----
From: Rasmus Lerdorf [mailto:rasmus <email protected>]
Sent: Wednesday, November 08, 2000 3:30 PM
To: John Guynn
Cc: Php-Db (E-mail)
Subject: Re: [PHP-DB] Date weirdness (php/mysql) (code included)

Please read: http://www.php.net/manual/function.date.php

The second argument to date() is in standard Unix timestamp format. ie.
the number of seconds since jan.1 1970. You can use mktime() to generate
this timestamp for you.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>