Can anyone help me with a problem I'm having trying to convert a String
into a Date
object without it being affected by timezone changes?
Specifically, when I receive 2020-07-14T15:27:39Z
from an http get request, I need to convert this into a Date
object so that I can calculate the time difference between this date and the current date.
However, every time I convert this String
into a Date
, it automatically adjusts for my local timezone and adds hours to it. Is there a way to convert the string into a Date
while ignoring timezone adjustments, since the original String
already contains the correct timezone information?
I've tried using methods like Date.parse
and new Date()
, but they all seem to apply my local timezone offset (which in my case is 3 hours). Does anyone have a solution to this issue?