I need to format a date as yyyy-MM-dd\'T\'HH:mm:ss.SSS\'Z\'
as specified by Parse\'s REST API for Facebook. I was wondering what the most lightweight
toISOString()
will return current UTC time only not the current local time. If you want to get the current local time in yyyy-MM-ddTHH:mm:ss.SSSZ
format then you should get the current time using following two methods
document.write(new Date(new Date().toString().split('GMT')[0]+' UTC').toISOString());
document.write(new Date(new Date().getTime() - new Date().getTimezoneOffset() * 60000).toISOString());