Date.now()

Date:

Share post:

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.

The post Date.now() appeared first on David Walsh Blog.

Source link

spot_img

Related articles

September Patch Tuesday handles 81 CVEs – Sophos News

.Microsoft on Tuesday announced 81 patches affecting 15 product families. Nine of the addressed issues are considered by...

Follow This Advice Before Switching to a New iPhone 17

Are you considering getting one of the new iPhone 17 models? While it’s always tempting to unbox a...

Just Look How Bloody Gross Universal’s ‘Terrifier’ Haunted House Is

Damien Leone, the writer and director of the Terrifier film...

Turtle Beach Unveils New Range Of Officially Licensed Switch 2 Accessories – Controllers, Cases And More

If you're still on the hunt for certain Switch 2 accessories and are looking for alternatives to Nintendo's...