0

Java – Convert LocalDateTime to OffsetDateTime

Last Updated on

This post is about how to convert LocalDateTime to OffsetDateTime at the current zone offset.

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 an OffsetDateTime object. We just want the zone offset based on where we execute the codes.

Codes

Testing

Karl San Gabriel

Karl San Gabriel

Professional Software Developer