Complete the code to get the current timestamp in milliseconds.
var timestamp = [1]();Date.now() returns the current timestamp in milliseconds since January 1, 1970.
Complete the code to convert a Date object to a timestamp in milliseconds.
var timestamp = new Date().[1]();getTime() returns the timestamp in milliseconds from a Date object.
Fix the error in the code to get the current timestamp in seconds.
var timestamp = Math.floor(Date.[1]() / 1000);
Date.now() returns the current timestamp in milliseconds. Dividing by 1000 and using Math.floor gives seconds.
Fill both blanks to create a timestamp string in ISO format and get its timestamp in milliseconds.
var isoString = new Date().[1](); var timestamp = new Date(isoString).[2]();
toISOString() converts the date to ISO string format.
getTime() converts the ISO string back to milliseconds timestamp.
Fill all three blanks to create a UNIX timestamp in seconds from a Date object.
var date = new Date(); var milliseconds = date.[1](); var seconds = Math.[2](milliseconds / [3]);
getTime() gets milliseconds from the Date.
Math.floor() rounds down to whole seconds.
1000 converts milliseconds to seconds.