Java ZonedDateTime Calculate parseZonedDateTime(String zonedDateTimeString, String variableName)

Here you can find the source of parseZonedDateTime(String zonedDateTimeString, String variableName)

Description

parse Zoned Date Time

License

Open Source License

Return

a ZonedDateTime with seconds accuracy

Declaration

public static ZonedDateTime parseZonedDateTime(String zonedDateTimeString, String variableName) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.time.ZonedDateTime;

import java.time.format.DateTimeParseException;
import java.time.temporal.ChronoUnit;

public class Main {
    /**/*w w  w . ja v  a 2 s. co m*/
     * @return a ZonedDateTime with seconds accuracy
     */
    public static ZonedDateTime parseZonedDateTime(String zonedDateTimeString, String variableName) {
        if (zonedDateTimeString == null)
            throw new IllegalArgumentException(variableName + " must not be null");

        try {
            return ZonedDateTime.parse(zonedDateTimeString).truncatedTo(ChronoUnit.SECONDS);
        } catch (DateTimeParseException e) {
            throw new IllegalArgumentException(variableName + " could not be parsed: " + e.getMessage());
        }
    }
}

Related

  1. isoDateTime(ZonedDateTime zonedDateTime)
  2. mapToZonedDateTime(final Date date)
  3. max(ZonedDateTime a, ZonedDateTime b)
  4. oneDayLater(ZonedDateTime baseDate)
  5. parseZdtToDate(ZonedDateTime zdt)
  6. preProcess(String Val, ZonedDateTime BaseTimeMarker)
  7. printDateTimeCompact(ZonedDateTime ZDT, boolean PrintTime, boolean PrintSeconds)
  8. printDateTimeSuperCompact(ZonedDateTime ZDT)
  9. roundTimeMinQuarter(ZonedDateTime dateTime)