Sunday, 15 February 2015

javascript - momentjs toISOString without the "z" -


I need to make the date of ISO-8601 I am with Momentjs

moment (my_date) .toOString () To create an ISO date, the result is like this:

  2015-03-17T15: 12: 38.076 Z  
< P> I need to send an API on this date which is slightly different on the date (although this document says that they are using ISO-8601):

2015 -03-17T15: 12: 38.076-4: 00

What is the plan or what And there is no way to achieve the required format using?

Edit: I found a solution:

  moment.tz (my_date, "America / Argentina / Buenos_Aires"). Format ("YYYY-MM-DDTHH: Mm: ss.SSSZ")  

Momentjs can use the timezone:

  var newYork = moment.tz ("2014-06-01 12:00", "America / New York"); Var London = New York. Clone () Tz ("Europe / London"); NewYork.format (); // 2014-06-01T 12: 00: 00-04: 00 London. Format (); // 2014-06-01T17: 00: 00 + 01: 00  

z inidcates a UTC timestamp, the API is expected to differ in UTC and for this -4: 00 . If you want conversion between time zone, then I am suggesting to go from time to time

but is not a moment (). Format (); 2014-09-08T08: 02: 17-05: 00 gives time as ?


No comments:

Post a Comment