Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is special about dates before the year 1970?

I see a lot of discussion about getting dates that are pre-1970. For example, I see people ask a question like, "how do I get a date before 1970?"

What I'd like to know is what is so special about 1970? Why do people have trouble getting dates before that particular year? Was it the beginning of the universe or something?

like image 540
Voldemort Avatar asked Feb 23 '11 04:02

Voldemort


People also ask

How are dates before 1970 represented?

The Unix epoch is at the beginning of 1970 meaning that any timestamp prior to 1970 needs to be represented as a negative number representing the number of seconds until January 1st, 1970 00:00:00 UTC.

What is epoch date?

In a computing context, an epoch is the date and time relative to which a computer's clock and timestamp values are determined. The epoch traditionally corresponds to 0 hours, 0 minutes, and 0 seconds (00:00:00) Coordinated Universal Time (UTC) on a specific date, which varies from system to system.

What is a timestamp format?

The TIMESTAMP data type is used for values that contain both date and time parts. TIMESTAMP has a range of '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC. A DATETIME or TIMESTAMP value can include a trailing fractional seconds part in up to microseconds (6 digits) precision.

How do you read epoch time?

The Epoch time is a popular convention for computers to track the time. The Epoch time starts at00:00:00 Thu 01 Jan 1970 UTC and is measured in seconds. The Epoch time is thus the number of seconds since Epoch zero.


2 Answers

It is the beginning of the UNIX epoch, timestamp 0. All UNIX timestamps are the number of seconds since January 1st 1970 UTC. The moment of this writing is timestamp 1298440626.

UNIX timestamps pop up in the datetime libraries of a lot of languages and software, as storing times as a number of seconds is convenient for various reasons.

Since 1970 is time 0, dates before then can't typically be stored as timestamps.

like image 103
Dan Grossman Avatar answered Nov 03 '22 01:11

Dan Grossman


It has to do with UNIX times. They're strored as number of seconds since the epoch, and the epoch is defined as the start of the day January 1, 1970 (UTC).

That's also the cause for the upcoming Y2K38 bug where the value will roll over to negative sometime early Feb (from memory) in 2038. Unless they up it to beyond a signed 32-bit value, of course.

like image 32
paxdiablo Avatar answered Nov 02 '22 23:11

paxdiablo