I have a date picker on my page when I select any date when it gives a result similar to
Sun Sep 07 2014 00:00:00 GMT+0500 (Pakistan Standard Time)
And I need to format it: YYYY-MM-DDTHH:mm:ss Z
So, for this I use the syntax of the moment
var date='Sun Sep 07 2014 00:00:00 GMT+0500 (Pakistan Standard Time)';
moment(date).format('YYYY-MM-DDTHH:mm:ss Z');
which produces output
2014-09-07T00:00:00 +05:00
This is good, but my api expects a standard timezone offset of "Z" instead of playing out the local current timezone (like +5: 00) in my case.
So I want to create this
2014-09-07T00:00:00Z
How is this possible?
source
share