Ask any software program engineer and so they’ll inform you that coding date logic generally is a nightmare. Builders want to think about timezones, bizarre date defaults, and platform-specific date codecs. The simplest method to work with dates is to scale back the date to the simplest format doable — often a timestamp. To get the rapid time in integer format, you need to use Date.now
:
const now = Date.now(); // 1705190738870
I’ll oftentimes make use of Date.now()
in my console.log
statements to distinguish likewise console.log
outcomes from one another. You possibly can additionally use that date as a novel identifier for an occasion in a low-traffic atmosphere.
The put up Date.now() appeared first on David Walsh Weblog.