[BNM] MySQL date time formats
Dominic Mitchell
dom at happygiraffe.net
Tue Jul 4 16:39:40 BST 2006
On Tue, Jul 04, 2006 at 04:31:27PM +0100, Oliver Marshall wrote:
> I am creating a web report pulling data from a MySQL database we have
> here.
>
> The datetime field of this particular database (not created by me) is
> set as the type "BIGINT" and the date and times in it are 13 number long
> integers.
>
> Is this a normal way of storing date/times in mysql? Any suggestions how
> I can decipher the correct date from this ?
It's not unusual, it's likely to be the number of seconds since Jan 1st
1970. That's an old Unix convention[1]. If you have a chance, you're
probably better off using MySQL's native DATETIME type if you can
change the database.
As to interpreting those integers, have a look at localtime() and
strftime() in PHP.
http://uk.php.net/localtime
http://uk.php.net/strftime
-Dom
[1] http://en.wikipedia.org/wiki/Unix_Epoch
More information about the BNMList mailing list
BNMList is hosted by Screenlists, a Screen-Play.net service