I have some date and times. The dates and times are in GMT . I am currently using formatTime to print the times. However, the times are being reset by formatTime to account for the different timezone. What I am trying to achieve is, if the time was 08:AM in 000Z, then it shall print 08:AM no matter where the app is being used, no matter the current timezone
For example, the full start and stop dates are shown below:
//start
'2017-12-12T08:00:00.000Z'
//stop
'2017-12-31T09:00:00.000Z'
The start time and stop time are the time portions of start and stop
//start-time
'0001-01-01T08:00:00.000+00:00'
//stop-time
'0001-01-01T09:00:00.000+00:00'
I am currently trying to get the startTime and stopTime using
const startTime = formatTime('0001-01-01T08:00:00.000+00:00');
// {startTime} prints 3:00 AM instead of 8:00 AM
const stopTime = formatTime('0001-01-01T09:00:00.000+00:00');
// {stopTime} prints 4:00 AM instead of 9:00 AM
How do I make sure that start-time, and stop-time are displayed as 08:00 AM and 09:AM regardless of the current-time zone and the time-zone they were created in using formatTime ? Currently, displaying start time and stop time is resetting the time in regards to the current time zone. For example, 08:00 AM is being displayed as 3:00 AM as my current timezone is GMT-5. Thanks in advance !!