Here you can find the source of stringToZonedDateTimeUTC(String dateAsString)
public static ZonedDateTime stringToZonedDateTimeUTC(String dateAsString)
//package com.java2s; //License from project: Open Source License import java.time.*; import java.time.format.DateTimeFormatter; import java.util.Locale; public class Main { private static final java.lang.String DATE_TIME_PATERN = "yyyy-MM-dd HH:mm:ss"; public static ZonedDateTime stringToZonedDateTimeUTC(String dateAsString) { DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATE_TIME_PATERN, Locale.ENGLISH); LocalDateTime localDateTime = LocalDateTime.parse(dateAsString, formatter); return localDateTime.atZone(ZoneOffset.UTC); }// ww w .jav a 2 s . co m }