tags:

views:

491

answers:

5

Every time in PHP when I make a variable such as this one:

$date = strtotime($row['date']);
$date = date("M d Y \a\\t g:i A", $date); // Mmm dd YYYY at h:mm PM/AM

and somehow row['date'] happens to be 0, the date Dec 31 1969 at 7:00 PM is displayed on the screen? Google does not tell me much, I was wondering if this date had any significances.

+1  A: 

One format in which date objects are stored is the time in seconds that have elapsed from an arbitrary start time. Asking for a formatted version of "0" is like asking for that arbitrary start time. I don't remember why that date was chosen, but I'm sure Wikipedia does. See the article on Unix time below.

Read about Unix Time

Austin Fitzpatrick
+14  A: 

The Unix epoch is the time 00:00:00 UTC on 1 January 1970. This is the reference point for all time stamps. When you use PHP's date/time functions, you're always working with the number of seconds since the epoch. Time 0 is the epoch, and you (or your web server) must be on the east coast of the US, which is 5 hours behind UTC time.

echo
+3  A: 

Unix timestamps are measured in "time since the Unix Epoch", which is Midnight GMT at the end of Dec. 31 1969 (a.k.a. 00:00 GMT Jan 1 1970). Since you appear to be on Eastern Standard Time, which is GMT-5, you get 7pm Dec. 31st 1969 for a unix timestamp value of 0.

Amber
+1  A: 

Let me guess: you live on the east coast of the USA?

PHP, like many other systems uses the Unix epoch to measure time, i.e. a value of 0 represents January 1, 1970, midnight UTC - which is the same as Dec 31 1969 at 7:00 PM Eastern Standard Time.

Michael Borgwardt
A: 

i dunno much about any of this but i do know that i was checking the date & time on my ipod and that date January 1,1970 and the time 3:28am just showed up and when i tried o fix it, & it suddenly turned to December 29,1969 7:00pm & i realy just want to know if those dates and hours have any meaning ... you know, if i should know anything about them as to what happened exactly at that time..... ?

nana Castro