Answers for "add 2 microseconds to Date() js"

1

add 2 microseconds to Date() js

// get the current date & time (as milliseconds since Epoch)
const currentTimeAsMs = Date.now();

// Add 2 seconds
const adjustedTimeAsMs = currentTimeAsMs + 2;

// create a new Date object, using the adjusted time
const adjustedDateObj = new Date(adjustedTimeAsMs);
Posted by: Guest on March-08-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language