Why are dates calculated from January 1st, 1970?

后端 未结 7 824
自闭症患者
自闭症患者 2020-12-12 12:49

Is there any reason behind using date(January 1st, 1970) as default standard for time manipulation? I have seen this standard in Java as well as in Python. These two languag

相关标签:
7条回答
  • 2020-12-12 13:20

    Is there any reason behind using date(January 1st, 1970) as standard for time manipulation?

    No reason that matters.

    Python's time module is the C library. Ask Ken Thompson why he chose that date for an epochal date. Maybe it was someone's birthday.

    Excel uses two different epochs. Any reason why different version of excel use different dates?

    Except for the actual programmer, no one else will ever know why those those kinds of decisions were made.

    And...

    It does not matter why the date was chosen. It just was.

    Astronomers use their own epochal date: http://en.wikipedia.org/wiki/Epoch_(astronomy)

    Why? A date has to be chosen to make the math work out. Any random date will work.

    A date far in the past avoids negative numbers for the general case.

    Some of the smarter packages use the proleptic Gregorian year 1. Any reason why year 1?
    There's a reason given in books like Calendrical Calculations: it's mathematically slightly simpler.

    But if you think about it, the difference between 1/1/1 and 1/1/1970 is just 1969, a trivial mathematical offset.

    0 讨论(0)
  • 2020-12-12 13:21

    Yes, C (and its family). This is where Java took it too.

    0 讨论(0)
  • 2020-12-12 13:22

    January 1st, 1970 00:00:00 am is the zero-point of POSIX time.

    0 讨论(0)
  • 2020-12-12 13:26

    It is the standard of Unix time.

    Unix time, or POSIX time, is a system for describing points in time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

    0 讨论(0)
  • 2020-12-12 13:32

    why its always 1st jan 1970 , Because - '1st January 1970' usually called as "epoch date" is the date when the time started for Unix computers, and that timestamp is marked as '0'. Any time since that date is calculated based on the number of seconds elapsed. In simpler words... the timestamp of any date will be difference in seconds between that date and '1st January 1970' The time stamp is just a integer which started from number '0' on 'Midnight 1st January 1970' and goes on incrementing by '1' as each second pass For conversion of UNIX timestamps to readable dates PHP and other open source languages provides built in functions.

    0 讨论(0)
  • 2020-12-12 13:38

    Q) "Why are dates calculated from January 1st, 1970?"

    A) It had to be as recent as possible, yet include some past. There was most likely no significant other reason as a lot of people feel that same way.

    They knew it posed a problem if they placed it too far into the past and they knew it gave negative results if it was in the future. There was no need to go deeper in the past as events will most likely take place in the future.

    Notes: The mayans, on the other hand, had the need to place events into the past, since the had the knowledge of a lot of past, for which they made a long-term calender. Just to place all the routine phenomena on the calender.

    The timestamp was not meant as a calender, it's an Epoch. And I believe the mayans made their long-term calender using that same perspective. (meaning they knew damn well they didn't have any relations with the past, they just had the need to see it in a bigger scale)

    0 讨论(0)
提交回复
热议问题