admin管理员组

文章数量:1345174

Is there a simple way to convert standard Javascript date format to xs:dateTime

So I have a date value (new Date()) and I need in the format: 2015-01-16T20:26:53.974+03:00

so

Fri Jan 16 2015 22:26:53 GMT+0500 (Ekaterinburg Standard Time) -> 2015-01-16T20:26:53.974+03:00

It strange but cound't find simple solution.

Is there a simple way to convert standard Javascript date format to xs:dateTime

So I have a date value (new Date()) and I need in the format: 2015-01-16T20:26:53.974+03:00

so

Fri Jan 16 2015 22:26:53 GMT+0500 (Ekaterinburg Standard Time) -> 2015-01-16T20:26:53.974+03:00

It strange but cound't find simple solution.

Share Improve this question asked Jan 16, 2015 at 18:20 WHITECOLORWHITECOLOR 26.2k40 gold badges125 silver badges188 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 10

I believe this is the same as the ISO date format

var date = new Date();
var formatted = date.toISOString();

本文标签: xmlJavascript date to xsdateTimeStack Overflow