convert Unix To LocalDateTime - Java java.time

Java examples for java.time:LocalDateTime

Description

convert Unix To LocalDateTime

Demo Code


//package com.java2s;

import java.time.LocalDateTime;
import java.time.ZoneOffset;

public class Main {
    /**// w  w  w .  ja  v a  2 s.c om
     * 
     * @param unixTime expressed in seconds since January 1 1970 GMT, standard epoch
     * @return 
     */
    public static LocalDateTime convertUnixToLocalDateTime(long unixTime) {
        return LocalDateTime.ofEpochSecond(unixTime, 0, ZoneOffset.UTC);
    }
}

Related Tutorials