compare timestamps in javascript

前端 未结 4 1622
攒了一身酷
攒了一身酷 2021-01-02 17:52

I have a date saved in a string with this format: 2017-09-28T22:59:02.448804522Z this value is provided by a backend service.

Now, in javascript how can

4条回答
  •  时光取名叫无心
    2021-01-02 18:29

    const anyTime = new Date("2017-09-28T22:59:02.448804522Z").getTime();
    const currentTime = new Date().getTime();
    if(currentTime > anyTime){
        //codes
    }
    

提交回复
热议问题