Java ZonedDateTime Calculate convertDateToZonedDateTime(Date date, String timezone)

Here you can find the source of convertDateToZonedDateTime(Date date, String timezone)

Description

convert Date To Zoned Date Time

License

Apache License

Declaration

private static ZonedDateTime convertDateToZonedDateTime(Date date, String timezone) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.time.ZoneId;
import java.time.ZonedDateTime;

import java.util.Date;

public class Main {
    private static ZonedDateTime convertDateToZonedDateTime(Date date, String timezone) {
        if (timezone == null || timezone.equals("")) {
            return date.toInstant().atZone(ZoneId.systemDefault());
        }//  w  w  w . j ava2 s . c o  m
        return date.toInstant().atZone(ZoneId.of(timezone));
    }
}

Related

  1. asZonedDateTime(Date date)
  2. calculateTimeForSunrise(ZonedDateTime from, ZonedDateTime to)
  3. canonicalTimeString(ZonedDateTime time)
  4. cloneZonedDateTime(ZonedDateTime zonedDateTime)
  5. computeDays(ZonedDateTime Start, ZonedDateTime End)
  6. convertForPersistence(@Nullable ZonedDateTime dt)
  7. currentZonedDateTime()
  8. difference(ZonedDateTime t1, ZonedDateTime t2)
  9. diffMs(ZonedDateTime date1, ZonedDateTime date2)