Here you can find the source of parseZonedDateTime(String zonedDateTimeString, String variableName)
public static ZonedDateTime parseZonedDateTime(String zonedDateTimeString, String variableName)
//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()); } } }