vendredi 18 décembre 2020

Get Date Object with UTC instead of local time zone in vanilla javascript

I am uploading a date time to a field on a dynamics form, and the form needs to receive a UTC date time. If I do something like this:

new Date(new Date().toISOString()) 

If i console.log the date it shows as: Fri Dec 18 2020 14:27:39 GMT-0500 (Eastern Standard Time)

I want the object to print as the UTC time with UTC specified as the time zone, otherwise the form (expecting a date object) keeps uploading as the EST time.




Aucun commentaire:

Enregistrer un commentaire