How do you get a timestamp in JavaScript?

前端 未结 30 3158
情深已故
情深已故 2020-11-21 15:19

How can I get a timestamp in JavaScript?

Something similar to Unix timestamp, that is, a single number that represents the current time and date. Either as a number

30条回答
  •  眼角桃花
    2020-11-21 15:29

    In addition to the other options, if you want a dateformat ISO, you get can get it directly

    console.log(new Date().toISOString());

提交回复
热议问题