Java – Convert LocalDateTime to OffsetDateTime at the current Zone Offset

This short post demonstrates how to convert LocalDateTime object to OffsetDateTime object at the current zone offset where the codes are run.

Append with Zone Offset

Basically, we want to “append” a LocalDateTime object with the current zone offset without converting it  first to string object (to concatenate it with +/-##:##) and then to a OffsetDateTime object.

We just want the zone offset to be based on where on Earth the codes are executed.






Karl San Gabriel

Karl San Gabriel

Professional Software Developer