Javascript date parsing on Iphone

后端 未结 5 1556
予麋鹿
予麋鹿 2020-12-04 20:04

I\'m working on an offline capabable Javascript site that targets mobile devices. One such mobile device is the IPhone.

I\'m trying to parse a date from our REST API

5条回答
  •  时光说笑
    2020-12-04 20:31

    You might have better luck if you stick to ISO 8601 format:

    Date.parse("2010-03-15T10:30:00");
    
    // e.g.
    var d = new Date( Date.parse("2010-03-15T10:30:00") );
    console.log( d.toString() ); //Mon Mar 15 2010 10:30:00 GMT+0000 (BST)
    

提交回复
热议问题