I have the date 2023-04-03 and wanted to convert it into UTC time with range (start and end of the day)
2023-04-03T00:00:00 -> 2023-04-02T18:30:00z
2023-04-03T24:00:00 -> 2023-04-03T18:30:00z
Input: 2023-04-03
Need this output: 2023-04-02T06:30:00z, 2023-04-03T18:30:00z
I have tried LocalDate and SimpleDateFormatter, but they are not converting to this way.
LocalDateTime ldt = LocalDate.parse("2023-04-03").atStartOfDay();
ZonedDateTime zdt = ldt.atZone(ZoneId.of("UTC"));
Instant instant = zdt.toInstant();
System.out.println(":inst: " + instant.toString());
output of the above code:
Hello: 2016-06-12T00:00
:inst: 2016-06-12T00:00:00Z