Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

org.alfresco.util
Class ISO8601DateFormat
java.lang.Object
  org.alfresco.util.ISO8601DateFormat

public class ISO8601DateFormat
extends Object
Formatting support for ISO 8601 dates
    sYYYY-MM-DDThh:mm:ss.sssTZD
 
where:

Constructor Summary
ISO8601DateFormat()
Method Summary
static String
format(Date isoDate)
          Format date into ISO format (UCT0 / Zulu)
static String
formatToZulu(String isoDate)
          Normalise isoDate time to Zulu(UTC0) time-zone, removing any UTC offset.
static Calendar
getCalendar()
          Get a calendar object from cache.
static boolean
isTimeComponentDefined(String isoDate)
          Checks whether or not the given ISO8601-formatted date-string contains a time-component instead of only the actual date.
static Date
parse(String isoDate)
          Parse date from ISO formatted string.
static Date
parse(String isoDate, TimeZone timezone)
          Parse date from ISO formatted string, with an explicit timezone specified
static Date
parseDayOnly(String isoDate, TimeZone timezone)
          Parses the given ISO8601-formatted date-string, not taking into account the time-component.
static Date
parseInternal(String isoDate, TimeZone timezone)
          Parse date from ISO formatted string, either in the specified TimeZone, or with TimeZone information taken from the date
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail
ISO8601DateFormat
public ISO8601DateFormat()
Method Detail
getCalendar
public static Calendar getCalendar()
Get a calendar object from cache.
Returns:
calendar object from cache or newly created (if cache is empty)

format
public static String format(Date isoDate)
Format date into ISO format (UCT0 / Zulu)
Parameters:
isoDate - the date to format
Returns:
the ISO Zulu timezone formatted string

formatToZulu
public static String formatToZulu(String isoDate)
Normalise isoDate time to Zulu(UTC0) time-zone, removing any UTC offset.
Returns:
the ISO Zulu timezone formatted string e.g 2011-02-04T17:13:14.000+01:00 -> 2011-02-04T16:13:14.000Z

parse
public static Date parse(String isoDate)
Parse date from ISO formatted string. The ISO8601 date must include TimeZone offset information
Parameters:
isoDate - ISO string to parse
Returns:
the date
Throws:
AlfrescoRuntimeException - if the parse failed

parse
public static Date parse(String isoDate,
                         TimeZone timezone)
Parse date from ISO formatted string, with an explicit timezone specified
Parameters:
isoDate - ISO string to parse
timezone - The TimeZone the date is in
Returns:
the date
Throws:
AlfrescoRuntimeException - if the parse failed

parseInternal
public static Date parseInternal(String isoDate,
                                 TimeZone timezone)
Parse date from ISO formatted string, either in the specified TimeZone, or with TimeZone information taken from the date
Parameters:
isoDate - ISO string to parse
timezone - The time zone, null means default time zone
Returns:
the date
Throws:
AlfrescoRuntimeException - if the parse failed

isTimeComponentDefined
public static boolean isTimeComponentDefined(String isoDate)
Checks whether or not the given ISO8601-formatted date-string contains a time-component instead of only the actual date.
Returns:
true, if time is present.

parseDayOnly
public static Date parseDayOnly(String isoDate,
                                TimeZone timezone)
Parses the given ISO8601-formatted date-string, not taking into account the time-component. The time-information for the will be reset to zero.
Parameters:
isoDate - the day (formatted sYYYY-MM-DD) or a full date (sYYYY-MM-DDThh:mm:ss.sssTZD)
timezone - the timezone to use
Returns:
the parsed date
Throws:
AlfrescoRuntimeException - if the parsing failed.

Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005–2016 Alfresco Software. All rights reserved.

Java API documentation generated with DocFlex/Javadoc 1.6.1 using JavadocPro template set.