Conversion
I have a timestamp with an offset (-6
) in the following format:
2019-11-30T00:01:00.000-06:00
and I want to convert it to an UTC timestamp, like:
2019-11-30T06:01:00.000Z
Attempt
I tried it the following way:
String text = "2019-11-30T00:01:00.000-06:00";
LocalDate date = LocalDate.parse(text, DateTimeFormatter.BASIC_ISO_DATE);
System.out.println(date.toInstant());
but it is not compiling:
The method
toInstant()
is undefined for the typeLocalDate
How am I supposed to do this correctly?