Collaboration API Documentation

com.filenet.bso.api.util
Class BsoDateUtil

java.lang.Object
  |
  +--com.filenet.bso.api.util.BsoDateUtil

public class BsoDateUtil
extends java.lang.Object

This class provides date conversion methods.


Constructor Summary
BsoDateUtil()
           
 
Method Summary
static java.lang.String convertDateToISODate(java.util.Date dateVal)
          Converts a java.util.date object to an ISO-date-formatted string.
static java.lang.String convertDateToW3CDate(java.util.Date dateVal, boolean bDateOnly)
          Converts a java.util.date object to a W3C-date-formatted string.
static java.util.Date convertISODateToDate(java.lang.Object dateVal)
          Converts an ISO-date-formatted string to a java.util.date object.
static java.util.Date convertW3CDateToDate(java.lang.Object dateVal, BooleanRef bDateOnlyVal)
          Converts a W3C-date-formatted string to a java.util.date object.
static boolean isLeapYear(int yr)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BsoDateUtil

public BsoDateUtil()
Method Detail

convertISODateToDate

public static java.util.Date convertISODateToDate(java.lang.Object dateVal)
                                           throws BsoException
Converts an ISO-date-formatted string to a java.util.date object.

The DateTime format from ISO 8601 is:

    YYYYMMDDThhmmss[,f]Z

where:
YYYY represents a 4-digit year
MM represents a 2-digit month in the range of 01-12
DD represents a 2-digit day in the range 01-31
T is mandatory and separates the date and time components
hh represents a 2-digit hour in the range of 00-23
mm represents a 2-digit minute in the range of 00-59
ss represents a 2-digit second in the range of 00-59
,f is optional and represents decimal fractions of a second to arbitrary precision
Z is mandatory and indicates that the time is in Coordinated Universal Time or GMT

Parameters:
dateVal - A String object containing an ISO-date-formatted string.

Returns:
A Date object.

Throws:
BsoException - Thrown if the format of the input is invalid.

convertDateToISODate

public static java.lang.String convertDateToISODate(java.util.Date dateVal)
Converts a java.util.date object to an ISO-date-formatted string.

The DateTime format from ISO 8601 is:

    YYYYMMDDThhmmss[,f]Z

where:
YYYY represents a 4-digit year
MM represents a 2-digit month in the range of 01-12
DD represents a 2-digit day in the range 01-31
T is mandatory and separates the date and time components
hh represents a 2-digit hour in the range of 00-23
mm represents a 2-digit minute in the range of 00-59
ss represents a 2-digit second in the range of 00-59
,f is optional and represents decimal fractions of a second to arbitrary precision
Z is mandatory and indicates that the time is in Coordinated Universal Time or GMT

Parameters:
dateVal - An object of type java.util.date.

Returns:
An ISO-date-formatted string.

isLeapYear

public static boolean isLeapYear(int yr)

convertDateToW3CDate

public static java.lang.String convertDateToW3CDate(java.util.Date dateVal,
                                                    boolean bDateOnly)
Converts a java.util.date object to a W3C-date-formatted string.

The W3C DateTime format extends the ISO 8601 Date format:

    YYYY-MM-DDThh:mm:ss[.ss][Z|((+|-)hh:mm)] or YYYY-MM-DD[Z|((+|-)hh:mm)]

where:
YYYY represents a 4-digit year
MM represents a 2-digit month in the range of 01-12
DD represents a 2-digit day in the range 01-31
T is optional. If present, the format includes date and time; otherwise, includes date only.
hh represents a 2-digit hour in the range of 00-23
mm represents a 2-digit minute in the range of 00-59
ss represents a 2-digit second in the range of 00-59
.sss is optional and represents milliseconds.
Z|((+|-)hh:mm) is timezone and is optional. Can be specified as the letter Z, which represents GMT, or as time differences between local time and GMT. For example, in 1999-05-31T13:20:00-05:00, -05:00 is for EST. If not present, the time defaults to GMT.

Parameters:
dateVal - An object of type java.util.date.

bDateOnly - This is a pass-in parameter. If true, the returned W3C format string contains only a date; if false, the returned string contains both date and time.

Returns:
A W3C-date-formatted string.

convertW3CDateToDate

public static java.util.Date convertW3CDateToDate(java.lang.Object dateVal,
                                                  BooleanRef bDateOnlyVal)
                                           throws BsoException
Converts a W3C-date-formatted string to a java.util.date object.

The W3C DateTime format extends the ISO 8601 Date format:

    YYYY-MM-DDThh:mm:ss[.ss][Z|((+|-)hh:mm)] or YYYY-MM-DD[Z|((+|-)hh:mm)]

where:
YYYY represents a 4-digit year
MM represents a 2-digit month in the range of 01-12
DD represents a 2-digit day in the range 01-31
T is optional. If present, the format includes date and time, otherwise, include date only.
hh represents a 2-digit hour in the range of 00-23
mm represents a 2-digit minute in the range of 00-59
ss represents a 2-digit second in the range of 00-59
.sss is optional and represents milliseconds.
Z|((+|-)hh:mm) is timezone and is optional. Can be specified as the letter Z, which represents GMT, or as time differences between local time and GMT. For example, in 1999-05-31T13:20:00-05:00, -05:00 is for EST. If not present, the time defaults to GMT.

Parameters:
dateVal - A String object containing a W3C-date-formatted string.

bDateOnlyVal - The caller must create an object of BooleanRef to receive a boolean value or pass null. A value of true indicates that the dateVal parameter contains date information only. A value of false indicates that the dateVal parameter contains both date and time. The BooleanRef class is for the purpose of pass-by-reference, since the Java built-in Boolean class is immutable.

Returns:
A Java Date object.

Throws:
BsoException - Thrown if the format of the input is invalid.

Collaboration API Documentation

Copyright ?2002 - 2005 FileNet Corporation. All rights reserved.