Convert LocalDateTime to LocalDateTime in UTC

Sarika.S picture Sarika.S · Jan 6, 2016 · Viewed 142.7k times · Source

Convert LocalDateTime to LocalDateTime in UTC.

LocalDateTime convertToUtc(LocalDateTime date) {

    //do conversion

}

I searched over net. But did not get a solution

Answer

slorinc picture slorinc · Jan 10, 2018

I personally prefer

LocalDateTime.now(ZoneOffset.UTC);

as it is the most readable option.