com.filenet.wcm.toolkit.server.util
Class WcmDateUtil
- java.lang.Object
com.filenet.wcm.toolkit.server.util.WcmDateUtil
- public class WcmDateUtil
- extends java.lang.Object
The W3C DateTime format extends the ISO 8601 Date format:
YYYY-MM-DDThh:mm:ss[.sss][TimeZone] or YYYY-MM-DD[TimeZone]
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 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.
TimeZone is optional. It could be letter Z, which represents GMT, or time differences
between local time and GMT, for example, in 1999-05-31T13:20:00-05:00, -05:00 is for EST.
If it is not present, the time defaults to LOCAL TIME ZONE!
For reference, see http://www.w3.org/TR/NOTE-datetime
Field Summary
| Modifier and Type | Field and Description |
|---|---|
|
TIME_ZONE_GMT
|
Method Summary
| Modifier and Type | Method and Description |
|---|---|
|
compareDates(java.lang.String isoDateOne,java.lang.String isoDateTwo)
Compares dates and returns true if they are equal
|
|
convertDateToW3CDate(java.util.Calendar cal,boolean bDateOnly)
Converts Date object into W3C-date-formatted string.
|
|
convertDateToW3CDate(java.util.Date date,boolean bDateOnly)
Deprecated. Use convertDateToW3CDate(Calendar cal, boolean bDateOnly)
|
|
convertW3CDateToCalendar(java.lang.String str,boolean hyphenated)
|
|
convertW3CDateToCalendar(java.lang.String str,boolean hyphenated,java.util.TimeZone defaultTimeZone)
|
|
convertW3CDateToDate(java.lang.String str)
Parses the string with W3C-formatted date and returns java Date object.
|
|
convertW3CDateToDate(java.lang.String str,boolean hyphenated)
Parses the string with W3C-formatted date and returns java Date object.
|
|
formatCompressedISODateTime(java.lang.String month,java.lang.String day,java.lang.String year)
Puts the date in compressed W3C format without validation.
|
|
formatDateTime(java.lang.String locale,java.lang.String isoDateTime,java.lang.String dateFormat,java.lang.String timeFormat)
Formats a date using separate format strings for date and time format
|
|
formatISODateTime(java.lang.String month,java.lang.String day,java.lang.String year)
Puts the date in W3C format without validation.
|
|
getFormattedDate(java.util.Locale locale,java.lang.String isoDateTime)
Get the formatted date corresponding to the specified W3C formatted
date/time using the specified locale.
|
|
getFormattedDate(java.lang.String locale,java.lang.String isoDateTime)
Get the formatted date corresponding to the specified W3C formatted
date/time using the specified locale.
|
|
getFormattedDateTime(java.util.Locale locale,java.lang.String isoDateTime)
Get the formatted date/time corresponding to the specified W3C formatted
date/time using the specified locale.
|
|
getFormattedDateTime(java.lang.String locale,java.lang.String isoDateTime)
Get the formatted date/time corresponding to the specified W3C formatted
date/time using the specified locale.
|
|
localISODateTime(java.lang.String isoDateTime)
Returns the date in W3C format shifted from GMT to local time.
|
|
parseCompressedISODateTimeNoShift(java.lang.String isoDateTime)
Parses an W3C-formatted date String into a Date object.
|
|
parseISODateTimeNoShift(java.lang.String isoDateTime)
Parses an W3C-formatted date String into a Date object.
|
|
validateCompressedISODateTime(java.lang.String newDate,java.lang.String min,java.lang.String max)
Validates a date and returns it in GMT time zone.
|
|
validateISODateTime(java.lang.String newDate,java.lang.String min,java.lang.String max)
Validates a date and returns it in GMT time zone.
|
|
validateISODateTimeNoShift(java.lang.String input,java.lang.String min,java.lang.String max,java.util.Locale locale,java.util.TimeZone tz)
Validates a date for min and max.
|
|
validateMonthDayYear(int month,int day,int year)
Validates the month, day, and year values of a date.
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail
TIME_ZONE_GMT
- public static final java.util.TimeZone TIME_ZONE_GMT
Method Detail
formatDateTime
- public static java.lang.String formatDateTime( java.lang.String locale,
- java.lang.String isoDateTime,
- java.lang.String dateFormat,
- java.lang.String timeFormat)
- throws java.lang.Exception
locale - encoded locale isoDateTime - date/time in iso gmt dateFormat - timeFormat - java.lang.ExceptiongetFormattedDate
- public static java.lang.String getFormattedDate( java.util.Locale locale,
- java.lang.String isoDateTime)
- throws java.lang.Exception
locale - The Locale object specifying the locale isoDateTime - The W3C date/time value in GTM time zone java.lang.ExceptiongetFormattedDate
- public static java.lang.String getFormattedDate( java.lang.String locale,
- java.lang.String isoDateTime)
- throws java.lang.Exception
locale - The String locale value as specified by WcmUi.encodeLocale isoDateTime - The W3C date/time value in GTM time zone java.lang.ExceptiongetFormattedDateTime
- public static java.lang.String getFormattedDateTime( java.util.Locale locale,
- java.lang.String isoDateTime)
- throws java.lang.Exception
locale - The Locale object specifying the locale isoDateTime - The W3C date/time value in GMT time zone java.lang.ExceptiongetFormattedDateTime
- public static java.lang.String getFormattedDateTime( java.lang.String locale,
- java.lang.String isoDateTime)
- throws java.lang.Exception
locale - The String locale value as specified by WcmUi.encodeLocale isoDateTime - The W3C date/time value in GMT time zone java.lang.ExceptionlocalISODateTime
- public static java.lang.String localISODateTime( java.lang.String isoDateTime)
- throws java.lang.Exception
isoDateTime - The W3C date/time value in GMT time zone java.lang.ExceptionformatISODateTime
- public static java.lang.String formatISODateTime( java.lang.String month,
- java.lang.String day,
- java.lang.String year)
month - The month, 2 chars or less day - The day, 2 chars or less year - The year, 4 chars or less formatCompressedISODateTime
- public static java.lang.String formatCompressedISODateTime( java.lang.String month,
- java.lang.String day,
- java.lang.String year)
month - The month, 2 chars or less day - The day, 2 chars or less year - The year, 4 chars or less validateISODateTimeNoShift
- public static java.lang.String validateISODateTimeNoShift( java.lang.String input,
- java.lang.String min,
- java.lang.String max,
- java.util.Locale locale,
- java.util.TimeZone tz)
- throws java.lang.Exception
input - The date to validate in ISO format, GMT time. min - The minimum date value in W3C format max - The maximum date value in W3C format java.lang.ExceptionvalidateISODateTime
- public static java.lang.String validateISODateTime( java.lang.String newDate,
- java.lang.String min,
- java.lang.String max)
- throws java.lang.Exception
newDate - The date to validate in W3C format, local time min - The minimum date value in W3C format max - The maximum date value in W3C format java.lang.ExceptionvalidateCompressedISODateTime
- public static java.lang.String validateCompressedISODateTime( java.lang.String newDate,
- java.lang.String min,
- java.lang.String max)
- throws java.lang.Exception
newDate - The date to validate in W3C format, local time min - The minimum date value in W3C format max - The maximum date value in W3C format java.lang.ExceptionvalidateMonthDayYear
- public static boolean validateMonthDayYear( int month,
- int day,
- int year)
month - Integer holding the month day - Integer holding the day year - Integer holding the year parseISODateTimeNoShift
- public static java.util.Date parseISODateTimeNoShift( java.lang.String isoDateTime)
- throws java.text.ParseException
isoDateTime - The W3C formatted date/time java.text.ParseExceptionparseCompressedISODateTimeNoShift
- public static java.util.Date parseCompressedISODateTimeNoShift( java.lang.String isoDateTime)
- throws java.text.ParseException
isoDateTime - The W3C formatted date/time java.text.ParseExceptionconvertDateToW3CDate
- public static java.lang.String convertDateToW3CDate( java.util.Date date,
- boolean bDateOnly)
convertDateToW3CDate
- public static java.lang.String convertDateToW3CDate( java.util.Calendar cal,
- boolean bDateOnly)
cal - an object of type java.util.date bDateOnly - This is a pass-in parameter. If true,
the returned W3C format string only contains date, otherwise if false,
the returned string contains both date and time. compareDates
- public static boolean compareDates( java.lang.String isoDateOne,
- java.lang.String isoDateTwo)
isoDateOne - First date to compare isoDateTwo - Second date to compare convertW3CDateToDate
- public static java.util.Date convertW3CDateToDate( java.lang.String str)
- throws WcmException
str - a String object containing an W3C-date-formatted string. WcmException - if the input is not in the right format. convertW3CDateToCalendar
- public static java.util.Calendar convertW3CDateToCalendar( java.lang.String str,
- boolean hyphenated)
- throws WcmException
convertW3CDateToCalendar
- public static java.util.Calendar convertW3CDateToCalendar( java.lang.String str,
- boolean hyphenated,
- java.util.TimeZone defaultTimeZone)
- throws WcmException
convertW3CDateToDate
- public static java.util.Date convertW3CDateToDate( java.lang.String str,
- boolean hyphenated)
- throws WcmException
str - a String object containing an W3C-date-formatted string. hyphenated - Specify true to indicate date/time format either "2004-05-01..." or "20040501..." WcmException - if the input is not in the right format.