Java examples for java.time:OffsetDateTime
ms -> OffsetDateTime object.
//package com.java2s; import java.time.Instant; import java.time.OffsetDateTime; import java.time.ZoneId; public class Main { public static void main(String[] argv) throws Exception { long ms = 2; System.out.println(ms2OffsetDateTime(ms)); }//from w w w . j a v a2 s . c o m /** * ms -> OffsetDateTime object. * @param ms millisecond * @return LocalDateTime */ public static OffsetDateTime ms2OffsetDateTime(final long ms) { return OffsetDateTime.ofInstant(Instant.ofEpochMilli(ms), ZoneId.systemDefault()); } }