I have an API that gives me this JSON response
{
"time": "2020-05-25T05:18:02.279842+01:00",
"timezone_name": "LMT",
"timezone": "Europe/London"
}
Now, I have 2 problems.
Converting the time to date object. I used
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSZ")but, gives me parse exception. I think it’s because of milliseconds which is in 6 digits SSSSSS(279842). So I converted this2020-05-25T05:18:02.279842+01:00"to2020-05-25T05:18:02.279+01:00"which worked. I’m not satisfied with string manipulation.When I format the date from above, I see the time in my local time zone not the London time. I think I have to set the time zone for the date object which is given in the time zone.
Overall, I just want to neatly parse the txt to data object and show the time in given time zone.
Appreciate your inputs.