question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unix timestamp is incorrect?

See original GitHub issue

if (new Date().getTimezoneOffset() === 0) then dayjs.unix(1550251173).startOf('day').unix() returns 1550188800.

if (new Date().getTimezoneOffset() === 300) then dayjs.unix(1550251173).startOf('day').unix() returns 1550206800.

A Unix timestamp is by definition a count of seconds from “00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC)” (http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_16). Thus, the correct result should always be 1550188800.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
iamkuncommented, Mar 6, 2019

🎉 This issue has been resolved in version 1.8.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

1reaction
ghostcommented, Feb 16, 2019

Because in dayjs.unix(1550251173), dayjs parses and displays in local time. The same in momentjs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

date - Unix timestamp is not correct in JavaScript, but is correct ...
Javascript's timestamps are not standard unix timestamps. They use milliseconds and therefore require a multiplication by 1000:
Read more >
Unix time - Wikipedia
Unix time is a date and time representation widely used in computing. It measures time by the number of seconds that have elapsed...
Read more >
Timestamps, Time Zones, Time Ranges, and Date Formats
Learn how Sumo Logic manages timestamps, time zones, time ranges, and dates, and the configuration options that are available.
Read more >
Timestamp year incorrect : r/Discordjs - Reddit
I pass in the "intraction.guild.createdTimestamp" into <t:timestamp> in a message and this is what it displays. The year is incorrect.
Read more >
Spark SQL - Working with Unix Timestamp
_ //Convert Timestamp to Unix timestamp val inputDF ... From the above code, printSchema() and show(false) on DataFrame yields below output.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found