Here you can find the source of parseIsoDate(@Nonnull String asString)
@Nonnull public static Date parseIsoDate(@Nonnull String asString) throws IllegalArgumentException
//package com.java2s; /***************************************************************************************** * *** BEGIN LICENSE BLOCK *****//from w w w. jav a 2 s . c o m * * Version: MPL 2.0 * * echocat Jomon, Copyright (c) 2012-2013 echocat * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * *** END LICENSE BLOCK ***** ****************************************************************************************/ import javax.annotation.Nonnull; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String ISO_PATTERN = "yyyy-MM-dd'T'HH:mm:ssZ"; @Nonnull public static Date parseIsoDate(@Nonnull String asString) throws IllegalArgumentException { try { return new SimpleDateFormat(ISO_PATTERN).parse(asString); } catch (final ParseException e) { throw new IllegalArgumentException( "Could not parse: " + asString + ", it does not match pattern: " + ISO_PATTERN, e); } } }