[BNM] MySQL date time formats
Oliver Marshall
Oliver.Marshall at g2support.com
Tue Jul 4 16:48:14 BST 2006
Grrrrr. I have to replicate this web report in MS Access as well.
Don't suppose you know if Access support such bonkers time/date formats
?
-----Original Message-----
From: dom at happygiraffe.net [mailto:dom at happygiraffe.net]
Sent: 04 July 2006 16:40
To: Brighton New Media
Subject: Re: [BNM] MySQL date time formats
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
--
BNM info/subscription/archives: http://www.brightonnewmedia.org/
BNM archive search: http://www.roddis.org/bnm/search.php
BNM Del.icio.us tag: http://del.icio.us/tag/bnm/
BNM Flickr group: http://www.flickr.com/groups/bnm/
BNM powered by http://www.screen-play.net/
More information about the BNMList mailing list
BNMList is hosted by Screenlists, a Screen-Play.net service