How to convert unix timestamp to calendar date moment.js

前端 未结 11 1966
遥遥无期
遥遥无期 2020-12-22 21:36

I have a unix timestamp, and I\'m trying to convert it into a calendar date such as MM/DD/YYYY. So far, I have this:



        
11条回答
  •  囚心锁ツ
    2020-12-22 21:57

    Using moment.js as you asked, there is a unix method that accepts unix timestamps in seconds:

    var dateString = moment.unix(value).format("MM/DD/YYYY");
    

提交回复
热议问题