Here you can find the source of getLocalDateTime(Date datetime, TimeZone timeZone)
Parameter | Description |
---|---|
datetime | java.util.Date source |
timeZone | java.util.TimeZone source |
public static LocalDateTime getLocalDateTime(Date datetime, TimeZone timeZone)
//package com.java2s; //License from project: Open Source License import java.util.Date; import java.util.TimeZone; import java.time.LocalDateTime; import java.time.ZoneId; public class Main { /**/*from w w w . j a va2 s .c om*/ * Find a {@link java.time.LocalDateTime} for the given user * {@link java.util.Date} and {@link java.util.TimeZone}. * * @param datetime {@link java.util.Date} source * @param timeZone {@link java.util.TimeZone} source * @return {@link java.time.LocalDateTime} corresponding to given datetime and timeZone */ public static LocalDateTime getLocalDateTime(Date datetime, TimeZone timeZone) { if (datetime == null) { return null; } if (timeZone == null) { return null; } ZoneId zoneId = timeZone.toZoneId(); return LocalDateTime.ofInstant(datetime.toInstant(), zoneId); } }