DEV Community

Discussion on: Do you prefer unix epoch (a number) or ISO 8601 (a string) for timestamps?

Collapse
 
weakish profile image
Jang Rush

timestap0 = 2016-12-31T23:59:59Z
timestap1 = 2016-12-31T23:59:60Z
timestap0.epoch == timestap1.epoch

That is why I prefer ISO 8601, more accurate and more human-readable.
And I do not think under the context of REST or GraphQL, a few extra bytes unix epoch saves will make any difference.

Collapse
 
jpilkahn profile image
Johannes Pilkahn • Edited

That's an entirely misconstrued perception there, Jang.

Whether you choose to express that second as a UNIX or ISO 8601 timestamp - it is not the same second.

timestap0.epoch == timestap1.epoch is just blatantly wrong.
Not even remotely opinion-territory.
Just wrong.

2016-12-31T23:59:59Z = 1483228799
2016-12-31T23:59:60Z = 1483228800
1483228799 != 1483228800

What's your platform? NT?

Collapse
 
weakish profile image
Jang Rush

pubs.opengroup.org/onlinepubs/9699... leap seconds are ignored in unix epoch.

Different implementations may or may not conform to this standard.