com.buck.commons.i18n
Class URISafeISO8601DateTime

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

public class URISafeISO8601DateTime
extends Object

Provides conversions for ISO-8601 URI-Safe Extended Notation. The standard notation supported by this class is "yyyyMMdd'T'HHmmssSSS'Z'". An example date formatted using this pattern is "20061115T191256235Z". This notation is safe for both URI and file system usage.

Author:
Robert J. Buck

Field Summary
static String ISO_8601_URISAFE_EXTENDED_PATTERN_Z
          The standard format pattern for ISO-8601 URI-Safe Extended Notation.
 
Constructor Summary
URISafeISO8601DateTime()
           
 
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_URISAFE_EXTENDED_PATTERN_Z

public static final String ISO_8601_URISAFE_EXTENDED_PATTERN_Z
The standard format pattern for ISO-8601 URI-Safe Extended Notation.

See Also:
Constant Field Values
Constructor Detail

URISafeISO8601DateTime

public URISafeISO8601DateTime()
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.