0

I'm new to this and I'm really confuse bout this format of date. Can Anyone tell me what kind of format is this(2021-04-18T00:00:00Z) how to convert it to utc 8+

Im developing a message extension for microsoft teams app, and I'm using MS graph API to get the data form the "Shifts App". Unfortunately, the 2021-04-18T00:00:00Z is completely different timezone and is very new to me. Thanks.

Dev
  • 2,428
  • 2
  • 14
  • 15
  • What have you tried so far? Where are you stuck? To me, this looks like a pretty standard date string according to ISO 8601 with zero offset – Nico Haase Apr 20 '21 at 06:50
  • I saw someone told to use moment.js? But I just wanna know if there is like, a OOTB function in javascript to convert iso to utc, so far I can't find any – user11781598 Apr 20 '21 at 06:56
  • Does https://stackoverflow.com/questions/4829569/parsing-iso-8601-date-in-javascript help? – Nico Haase Apr 20 '21 at 06:57
  • Or this? https://stackoverflow.com/questions/27012854/change-iso-date-string-to-date-object-javascript – Nico Haase Apr 20 '21 at 06:58
  • If that does not help, please edit your question to contain all code you've used to resolve the problem on your own – Nico Haase Apr 20 '21 at 06:59
  • Thank you. It helps, although I go for a different approach. I used the toLocaleTimeString() and toUTCString() – user11781598 Apr 20 '21 at 07:04
  • Glad that the above helped. Thanks for confirming :) – Dev Apr 27 '21 at 16:33

1 Answers1

0

Posting the Answer for better knowledge

Copying from @Nico Haase comments

Use toLocaleTimeString() and toUTCString() methods and follow this for more help

Change ISO Date String to Date Object - JavaScript

Sridevi-MSFT
  • 240
  • 1
  • 4