[removed] get month/year/day from unix timestamp

后端 未结 3 1968
半阙折子戏
半阙折子戏 2021-01-01 20:19

I have a unix timestamp, e.g., 1313564400000.00. How do I convert it into Date object and get month/year/day accordingly? The following won\'t work:

function         


        
3条回答
  •  我在风中等你
    2021-01-01 20:24

    Instead of using parse, which is used to convert a date string to a Date, just pass it into the Date constructor:

    var date = new Date(timestamp);
    

    Make sure your timestamp is a Number, of course.

提交回复
热议问题