Estafette
Compose Login
You are browsing eu.zone1 in read-only mode. Log in to participate.
rss-bridge 2024-01-17T12:06:16+00:00

Date.now()

Ask any software engineer and they’ll tell you that coding date logic can be a nightmare. Developers need to consider timezones, weird date defaults, and platform-specific date formats. The easiest way to work with dates is to reduce the date to the most simple format possible — usually a timestamp. To get the immediate time […]
The post Date.now() appeared first on David Walsh Blog.

---

Date.now()

David Walsh on
January 17, 2024

Ask any software engineer and they'll tell you that coding date logic can be a nightmare. Developers need to consider timezones, weird date defaults, and platform-specific date formats. The easiest way to work with dates is to reduce the date to the most simple format possible -- usually a timestamp. To get the immediate time in integer format, you can use Date.now:

`

const now = Date.now(); // 1705190738870

`

I will oftentimes employ Date.now() in my console.log statements to differentiate likewise console.log results from each other. You could also use that date as a unique identifier for an event in a low-traffic environment.

-->

[Image: Request Metrics real user monitoring]

[Image: Request Metrics real user monitoring]

---

[Original source](https://davidwalsh.name/date-now)

Reply