Question: My value localStartDateTime is a LocalDateTime, and used as part of an appointment displayed on a table. Everything I see shows converting it to a
My value localStartDateTime is a LocalDateTime, and used as part of an appointment displayed on a table. Everything I see shows converting it to a string, however, the variables in appointment call for a localdatetime. I cannot seem to get my formatting to work.
Is there a way to keep the formatting of the string and convert it to a local date time without seeing the "T", or should my appointment variable change from localdatetime to a timestamp?
ZonedDateTime UTCStartTime = startDateTime.atZone(ZoneId.of("UTC"));
ZonedDateTime StartTimeConverted = UTCStartTime.withZoneSameInstant(ZoneId.of(ZoneId.systemDefault().toString()));
LocalDateTime localStartDateTime = StartTimeConverted.toLocalDateTime();
Step by Step Solution
There are 3 Steps involved in it
It sounds like youre trying to convert a ZonedDateTime to a LocalDateTime while maintaining the same ... View full answer
Get step-by-step solutions from verified subject matter experts
