[removed] Calculate difference between two dates

前端 未结 4 1725
温柔的废话
温柔的废话 2021-01-15 03:23

I want to find difference between two Dates. For that I did subtract one Date object from another Date object. My code is as follows :

var d1 = new Date(); /         


        
4条回答
  •  有刺的猬
    2021-01-15 04:03

    Are you looking for this?

     Math.ceil((new Date(2012, 11, 23) - new Date(2012, 11, 21)) / 86400000) + 1
    

提交回复
热议问题