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

public static ZoneId of(String zoneId) 

Source Link

Document

Obtains an instance of ZoneId from an ID ensuring that the ID is valid and available for use.

Usage

From source file:sg.ncl.MainController.java

/**
 * Get simple ZonedDateTime from date string in the format 'YYYY-MM-DD'.
 * @param date  date string to convert/*from  w  ww .j ava  2 s .  c om*/
 * @return      ZonedDateTime of
 */
private ZonedDateTime convertToZonedDateTime(String date) {
    String[] result = date.split("-");
    return ZonedDateTime.of(Integer.parseInt(result[0]), Integer.parseInt(result[1]),
            Integer.parseInt(result[2]), 0, 0, 0, 0, ZoneId.of("Asia/Singapore"));
}