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