1

I am trying to retrieve 11 (hour) from the date string provided by the server which is 2020-07-12T11:00:00+02:00.

I tried using getHours() but returned with a local time hour. also tried using getUTCHours() but got the time with the 0 offset.

Jtaw Cañada
  • 147
  • 1
  • 7
  • Can you show the code you are using in your attempt to retreive said information? – phuzi Apr 07 '22 at 08:22
  • let hours = new Date(Date.parse('2022-07-12T11:00:00+02:00')).getHours(); returns 11 – Yogi Apr 07 '22 at 08:40
  • @Yogi tried and gave me 9 which was using the UTC 0 format. I want the literal hour from 2020-07-12T11:00:00+02:00. which is 11. – Jtaw Cañada Apr 07 '22 at 08:52
  • I can not duplicate this problem. Please update your question to include your code. The hours for Central European Timezone are 11 and the UTC hours are 09. – Yogi Apr 07 '22 at 09:23
  • Found an answer from https://stackoverflow.com/questions/47607666/how-to-extract-only-time-from-iso-date-format-in-javascript using regex. – Jtaw Cañada Apr 07 '22 at 09:30
  • Does this answer your question? [How to extract only time from iso date format in javascript?](https://stackoverflow.com/questions/47607666/how-to-extract-only-time-from-iso-date-format-in-javascript) – kca Apr 08 '22 at 19:50

0 Answers0