Use JavaScript to Parse Time

前端 未结 4 490
春和景丽
春和景丽 2021-02-04 14:13

This is probably something easy, but I\'m a bit confused how to do this. How can I, using JavaScript, parse only the time from the following ISO 8601 date string:



        
4条回答
  •  情歌与酒
    2021-02-04 14:35

    This is so called ISO 8601 format. Mochikit comes with a function to parse it,

    http://mochikit.com/doc/html/MochiKit/DateTime.html

    You can get a Date object like this,

      timestamp = isoTimestamp("2009-12-06T17:10:00");
    

    Just copy the function if you don't want use Mochikit.

提交回复
热议问题