Here you can find the source of toLocalDateString(ZonedDateTime zonedDateTime)
e.g.
Parameter | Description |
---|---|
zonedDateTime | a parameter |
public static String toLocalDateString(ZonedDateTime zonedDateTime)
//package com.java2s; //License from project: Open Source License import java.time.ZoneId; import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; public class Main { private static final ZoneId UTC = ZoneId.of("Z"); private static DateTimeFormatter localDateFormatter = DateTimeFormatter.ISO_LOCAL_DATE; /**//from w ww . ja v a2 s.co m * Converts a LocalDateTime to a UTC ISO_8601 string representation * <p> * e.g. <br/> * 1. LocalDateTime("2010-01-01") ==> "2010-12-01" <br/> * 2. LocalDateTime("2010-12-31") ==> "2010-12-31" <br/> * </p> * * @param zonedDateTime * @return UTC ISO_8601 date string */ public static String toLocalDateString(ZonedDateTime zonedDateTime) { return zonedDateTime.withZoneSameInstant(ZoneOffset.UTC).toLocalDate().format(localDateFormatter); } }