Example usage for java.time ZoneId of

List of usage examples for java.time ZoneId of

Introduction

In this page you can find the example usage for java.time ZoneId of.

Prototype

static ZoneId of(String zoneId, boolean checkAvailable) 

Source Link

Document

Parses the ID, taking a flag to indicate whether ZoneRulesException should be thrown or not, used in deserialization.

Usage

From source file:Main.java

public static void main(String[] args) {
    ZoneId z = ZoneId.of("UTC", new HashMap<>());

    System.out.println(z);/*from ww  w . j a v a2  s  . com*/
}

From source file:Main.java

public static void main(String[] args) {
    Map<String, String> map = new HashMap<String, String>();
    map.put("Pacific", "America/Los_Angeles");
    map.put("Mountain", "America/Denver");
    map.put("Central", "America/Chicago");
    map.put("Eastern", "America/New_York");
    ZoneId.of("Mountain", map);

}

From source file:org.pr.nb.clocks.model.NBClock.java

public NBClock(String zoneId) {
    this.zoneId = ZoneId.of(zoneId, ZoneId.SHORT_IDS);
    zoneDateTime = ZonedDateTime.now(this.zoneId);
    homeZone = StringUtils.equals(zoneId, ZoneId.systemDefault().getId());
}

From source file:org.eclipse.hawkbit.ui.utils.SPDateTimeUtil.java

/**
 * Get time zone id .ZoneId.SHORT_IDS used get id if time zone is
 * abbreviated like 'IST'./*from  ww  w.  j av a  2  s  .  c  om*/
 *
 * @param tz
 * @return ZoneId
 */
public static ZoneId getTimeZoneId(final TimeZone tz) {
    return ZoneId.of(tz.getID(), ZoneId.SHORT_IDS);
}

From source file:org.hippoecm.frontend.plugins.standards.datetime.DateTimePrinter.java

static ZoneId toZoneId(final TimeZone timeZone) {
    return ZoneId.of(timeZone.getID(), ZoneId.SHORT_IDS);
}

From source file:com.github.ithildir.airbot.service.impl.AirNowMeasurementServiceImpl.java

private long _parseTime(String dateString, String timeString, String timeZoneString) {

    int year = Integer.parseInt(dateString.substring(6)) + 2000;
    int month = Integer.parseInt(dateString.substring(0, 2));
    int dayOfMonth = Integer.parseInt(dateString.substring(3, 5));
    int hour = Integer.parseInt(timeString.substring(0, timeString.length() - 3));
    int minute = Integer.parseInt(timeString.substring(timeString.length() - 2));

    ZoneId zoneId = ZoneId.of(timeZoneString, _shortZoneIds);

    ZonedDateTime zonedDateTime = ZonedDateTime.of(year, month, dayOfMonth, hour, minute, 0, 0, zoneId);

    Instant instant = zonedDateTime.toInstant();

    return instant.toEpochMilli();
}