[erlang-bugs] Wrong gregorian date

Thijs Terlouw thijsterlouw@REDACTED
Tue Mar 2 05:33:47 CET 2010


So Sergei should use :

calendar:gregorian_seconds_to_datetime(1267451701+62167219200).

Where does that magic number "62167219200" come from? Here:
calendar:datetime_to_gregorian_seconds({{1970, 1, 1}, {0,0,0}}).

Thijs Terlouw
Shenzhen, China,
http://www.startinchina.com/



On Mon, Mar 1, 2010 at 11:33 PM, Alex Kutsko <alex.kutsko@REDACTED> wrote:
> Sorry to be precise you've got February, 29 of 0040 year
>
> On Mon, Mar 1, 2010 at 5:29 PM, Alex Kutsko <alex.kutsko@REDACTED> wrote:
>
>> But the date you provided is not gregorian seconds.
>> try
>> calendar:datetime_to_gregorian_seconds({date(),time()}).
>> 63434683473
>> .
>> The result you actually got is February 29, 2040 - you can ensure that this
>> year is leap year :).
>>
>>
>>
>> On Mon, Mar 1, 2010 at 4:05 PM, Sergei Fomin <dafgar@REDACTED>wrote:
>>
>>> Hello.
>>>
>>> It seems a part of calendar library thinks there is February 29, 2010.
>>>
>>> # date +%s
>>> 1267451701
>>>
>>> Eshell V5.7.4  (abort with ^G)
>>> 1> calendar:gregorian_seconds_to_datetime(1267451701).
>>> {{40,2,29},{13,55,1}}
>>>
>>>
>>> Best regards,
>>> Sergei Fomin
>>>
>>>
>>>
>>> ________________________________________________________________
>>> erlang-bugs (at) erlang.org mailing list.
>>> See http://www.erlang.org/faq.html
>>> To unsubscribe; mailto:erlang-bugs-unsubscribe@REDACTED
>>>
>>>
>>
>>
>> --
>> Best regards,
>> Alex Kutsko
>>
>
>
>
> --
> Best regards,
> Alex Kutsko
>


More information about the erlang-bugs mailing list