Re: MySQL base time?

by "Lyle Giese" <lyle(at)lcrcomputer.com>

 Date:  Tue, 29 Apr 2003 20:58:41 -0500
 To:  "Keith D Sellars" <Keith(at)webgraffix.com>
 Cc:  "'Hwg-Languages \(E-mail\)" <hwg-languages(at)hwg.org>
 References:  S0026260871
  todo: View Thread, Original
That's called an epoch.  And for a *nix, yes epoch is 1-1-1900.

Perl has builtin functions to handle the conversion.

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);

$year = $year + 1900;
$mon = $mon + 1;

if (length($mon) < 2) {
 $mon = "0" . "$mon"; }
if (length($mday) < 2) {
 $mday = "0" . "$mday"; }

$year is years since 1900, $mon is 0-11, $wday is 0-6, $yday is the julian
data and $isdst is daylight savings flag.

time above references right now.  Just replace time with the value from the
database.

Lyle

----- Original Message -----
From: "Keith D Sellars" <Keith(at)webgraffix.com>
To: <hwg-languages(at)hwg.org>
Sent: Tuesday, April 29, 2003 8:26 PM
Subject: MySQL base time?


> One of my databases has a field titled "time" which records the time a
> transaction occurs.  One such time is: 1051649099.
>
> I know this is in seconds and counts from a base date (don't know the
> correct term for that starting date, so please forgive my ignorance).
>
> What is the actual date from which the time is based and what is the
correct
> term for that date?
>
> I thought the starting date was something like  Jan 01,1970 at midnight.
> Assuming I am correct, then this date would represent April 5, 2003.
>
> Am I correct in this?
>
> Thanks,
> Keith D Sellars
> WebGraffix
> www.webgraffix.com
>
> "Making database sites seem easy"
>
>
>
>

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA