Java Data Type How to - Convert java.util.Date in LocalDate in UTC


We would like to know how to convert java.util.Date in LocalDate in UTC.


import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Date;
//w  ww  .  jav a 2s.  c  o  m
public class Main {

  public static void main(String[] args) {
    System.out.println(asLocalDateInUTC(new Date()));

  public static LocalDate asLocalDateInUTC(Date date) {
    ZoneId UTC = ZoneId.of("Z");
    return date.toInstant().atZone(UTC).toLocalDate();


The code above generates the following result.