Convert UNIX to readable date in javascript

后端 未结 3 2044
广开言路
广开言路 2020-12-22 04:46

I am trying to figure out, how i can convert a unix timestamp to a readable date using javascript.

For an example, i want to convert this unix: 1422360000, to a dat

相关标签:
3条回答
  • 2020-12-22 05:28

    try this:

    new Date(1422360000).toString()

    That will make your date look like the string you want.

    0 讨论(0)
  • 2020-12-22 05:31

    This is the exact solution to the question.

    var timestamp = 1422360000;                 
    var date = new Date(timestamp * 1000);
    

    Result: Tue Jan 27 2015 13:00:00 GMT+0100

    0 讨论(0)
  • 2020-12-22 05:45

    Simply use Date(value)

    value: Integer value representing the number of milliseconds since 1 January 1970 00:00:00 UTC (Unix Epoch).

    Code

    new Date(1422360000)
    
    0 讨论(0)
提交回复
热议问题