set Timezone For Date and return LocalDateTime - Java java.time

Java examples for java.time:LocalDateTime

Description

set Timezone For Date and return LocalDateTime

Demo Code


//package com.java2s;

import java.time.LocalDateTime;
import java.time.ZoneId;

import java.util.Date;

public class Main {
    public static LocalDateTime setTimezoneForDate(Date date) {
        return LocalDateTime.ofInstant(date.toInstant(),
                ZoneId.systemDefault());
    }//www  .jav a2s. c  om
}

Related Tutorials