com.buck.commons.i18n
Class ISO8601DateTime

java.lang.Object
  extended by com.buck.commons.i18n.ISO8601DateTime

public class ISO8601DateTime
extends Object

Provides conversions for ISO-8601 Extended Notation. The standard notation supported by this class is "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'". An example date formatted using this pattern is "2006-11-15T19:12:56.235Z".

Author:
Robert J. Buck

Field Summary
static String ISO_8601_EXTENDED_PATTERN_Z
          The standard format pattern for ISO-8601 Extended Notation.
 
Constructor Summary
ISO8601DateTime()
           
 
Method Summary
static String fromDate(Date date)
          Converts a java.util.Date object to its string representation.
static Date toDate(String iso8601Date)
          Converts an ISO 8601 DateTime to a Java date object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ISO_8601_EXTENDED_PATTERN_Z

public static final String ISO_8601_EXTENDED_PATTERN_Z
The standard format pattern for ISO-8601 Extended Notation.

See Also:
Constant Field Values
Constructor Detail

ISO8601DateTime

public ISO8601DateTime()
Method Detail

toDate

public static Date toDate(String iso8601Date)
                   throws ParseException
Converts an ISO 8601 DateTime to a Java date object.

Parameters:
iso8601Date - the extended ISO 8601 date string
Returns:
a Date object set to the specified time
Throws:
ParseException - if the iso8601Date is incorrectly formatted

fromDate

public static String fromDate(Date date)
Converts a java.util.Date object to its string representation. The date is represented as a time relative to the default timezone; that is, the string representation of the time in the current time zone.

Parameters:
date - the date to format
Returns:
a String representation of the date formatted using the ISO 8601 extended pattern


Copyright © 2013. All Rights Reserved.