Skip to content

Tag: date-arithmetic

How do you get a timestamp in JavaScript?

Something similar to Unix’s timestamp, that is a single number that represents the current time and date. Either as a number or a string. Answer Short & Snazzy: A unary operator like plus triggers the valueOf method in the Date object and it returns the timestamp (without any alteration). Details: On almost all current browsers you can use to