0

I'm currently pulling data from an API, and get returned a date/time in a string in the below format:

2020-08-27T13:26:11.983Z

I'm guessing the string can be separated as such:

Date: 2020-08-27 Time: T13:26:11.983Z

Though I'm not sure where the T and Z come into play?

How would I go about calculating the difference between the above string value and the current date/time?

The intended end result would be rendered in my React component as:

"x Hour/s y Minute/s ago"

Thanks so much in advance for your help everyone!

rizji
  • 323
  • 1
  • 3
  • 7
  • Also [ISO-8601 timestamps](https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations). – Abion47 Oct 02 '20 at 17:06
  • T really doesn't mean anything. It is just a separator that ISO (forgot the standard name) standard required. Did you try converting the string to date and then trying date 2 - date1? – banker box Oct 02 '20 at 17:07

0 Answers0