Java ZonedDateTime Calculate stringToZonedDateTimeUTC(String dateAsString)

Here you can find the source of stringToZonedDateTimeUTC(String dateAsString)

Description

string To Zoned Date Time UTC

License

Open Source License

Declaration

public static ZonedDateTime stringToZonedDateTimeUTC(String dateAsString) 

Method Source Code


//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
}

Related

  1. printDateTimeSuperCompact(ZonedDateTime ZDT)
  2. roundTimeMinQuarter(ZonedDateTime dateTime)
  3. roundUp(ZonedDateTime date)
  4. secondsSinceMidnight(ZonedDateTime ZDT)
  5. simplifyZonedDateTime(ZonedDateTime now, long timeToWait)
  6. timestampToZonedDateTime(Long timestamp)
  7. toEpochMillSeconds(ZonedDateTime time)
  8. toEpochTime(ZonedDateTime input)
  9. toLocalDateString(ZonedDateTime zonedDateTime)