mardi 25 mai 2021

How can i convert GTM-0006 to ISO without Adding hours

I'm working in a from who has a date field and by default it shows the current date

i set the date using this

 var date = new Date();  = Tue May 25 2021 17:06:01 GMT-0600 (Mountain Daylight Time) {}**

Everything works fine, but when i send the data to the controller, the json automatically converts it to ISO and the date recived by the controller is 6 hours in advance

I understand a little bit the context about GMT-0006 (my current timezone is 6 hours more than the 0 timezone), and the fact that my controllers recived the date in ISO format because when I converted to ISO format is the same problem

date.toISOString() = "2021-05-25T23:06:01.861Z"  (6 hours  in advance)

so my question is, there is a way to create a date that allows me to use .toISOString() and keep the same? or create a date with my current hour but -0000 so when i convert it to toISOString keeps the same?

Thanks you all for your help and sorry for my bad english




Aucun commentaire:

Enregistrer un commentaire