© 2002 BEA Systems, Inc.


com.bea.p13n.xml.schema
Class XMLDateTimeUtil

java.lang.Object
  |
  +--com.bea.p13n.xml.schema.XMLDateTimeUtil

public class XMLDateTimeUtil
extends java.lang.Object

ISO8601 date utility. This class will read and write the correct ISO standard date, time, and timeInstant tags


Constructor Summary
XMLDateTimeUtil()
          Default constructor.
 
Method Summary
static java.lang.String formatDate(java.util.Calendar aDate)
           
static java.lang.String formatDate(java.util.Date aDate)
          Format a date in ISO standard.
static java.lang.String formatTime(java.util.Calendar aTime)
           
static java.lang.String formatTime(java.util.Date aTime)
          Format a time in ISO standard.
static java.lang.String formatTimeInstant(java.util.Calendar aDateTime)
           
static java.lang.String formatTimeInstant(java.util.Date aDateTime)
          Format a date-time in ISO standard.
static java.lang.String getOffset(java.util.Calendar calendar)
          Create a string representing the offset for the date being formatted.
static void main(java.lang.String[] args)
           
static java.util.Calendar readDate(java.lang.String aDate)
           
static java.util.Date readDateAsDate(java.lang.String aDate)
          Parse the xml string back into a Date.
static java.util.Calendar readTime(java.lang.String aTime)
           
static java.util.Date readTimeAsDate(java.lang.String aTime)
          Parse the time back into a Date.
static java.util.Calendar readTimeInstant(java.lang.String aDateTime)
           
static java.util.Date readTimeInstantAsDate(java.lang.String aDateTime)
          Parse the date time back into a Date.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLDateTimeUtil

public XMLDateTimeUtil()
Default constructor.
Method Detail

formatDate

public static java.lang.String formatDate(java.util.Date aDate)
Format a date in ISO standard.

Parameters:
aDate -  
Returns:
correctly formatted string.

formatDate

public static java.lang.String formatDate(java.util.Calendar aDate)

readDateAsDate

public static java.util.Date readDateAsDate(java.lang.String aDate)
Parse the xml string back into a Date.

readDate

public static java.util.Calendar readDate(java.lang.String aDate)

formatTime

public static java.lang.String formatTime(java.util.Date aTime)
Format a time in ISO standard.

Parameters:
aTime -  
Returns:
correctly formatted string.

formatTime

public static java.lang.String formatTime(java.util.Calendar aTime)

readTimeAsDate

public static java.util.Date readTimeAsDate(java.lang.String aTime)
Parse the time back into a Date. This method uses the current date as the date to accompany the time string, so that the Date object returned will have the correct standard-vs-savings time offset. If you just format a time string with no date, you get that time on 1 January 1970, which will cause the time offset to be wrong during daylight-savings time.

readTime

public static java.util.Calendar readTime(java.lang.String aTime)

formatTimeInstant

public static java.lang.String formatTimeInstant(java.util.Date aDateTime)
Format a date-time in ISO standard.

Parameters:
aDateTime -  
Returns:
correctly formatted string.

formatTimeInstant

public static java.lang.String formatTimeInstant(java.util.Calendar aDateTime)

readTimeInstantAsDate

public static java.util.Date readTimeInstantAsDate(java.lang.String aDateTime)
Parse the date time back into a Date.

readTimeInstant

public static java.util.Calendar readTimeInstant(java.lang.String aDateTime)

getOffset

public static java.lang.String getOffset(java.util.Calendar calendar)
Create a string representing the offset for the date being formatted. The reason this needs to be called when the date is created, rather than set in a static manner, is that when someone creates a date for a time of year with a different savings/standard time than the current time, the offset needs to be correct. So this method returns the correct offset for the date being created.

main

public static void main(java.lang.String[] args)

© 2002 BEA Systems, Inc.

Copyright © 2002 BEA Systems, Inc. All Rights Reserved