変換特定の時間のタイムスタンプ

 

 

// 将时间戳转换具体时间
    toDates(回){
       CONST日付= 新しい日付(時間)
       CONST Y = date.getFullYear()
       CONST、M =(date.getMonth()+ 1 < 10' 0 ' +(日付。 getMonth()+ 1):date.getMonth()+ 1 CONST D =(date.getDate()< 10' 0 ' + date.getDate():date.getDate())
       CONST H = date.getHours( )< 10' 0 ' +date.getHours():date.getHours()
       constの分= date.getMinutes()< 10' 0 ' + date.getMinutes():date.getMinutes()
       CONST S = date.getSeconds()< 10' 0 ' + date.getSeconds():date.getSeconds()
       CONSTのdateTime = Y + ' ' + M + ' ' + D + ' ' + H + ' ' +ミン+ ' ' + S + " 
      リターンのdateTime
    }

 

その後、特定の時間とは、タイムスタンプに変換する場合:

 

VAR DATE = 新しい新しい A日付(' 2014年4月23日18がある:55:49:123 ' ); 
// 3つの入手する方法があります VAR TIME1 = date.getTimeを() ; VAR TIME2 = date.valueOf(); VARの TIME3 = 日付.parse(日付)。 console.log(TIME1)。// 1398250549123 にconsole.log(TIME2)。// 1398250549123 にconsole.log(TIME3)。// 1398250549000

おすすめ

転載: www.cnblogs.com/listen9436/p/12162905.html