|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.filenet.wcm.toolkit.server.util.WcmDateUtil
Various utility functions for working with dates.
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 | |
static java.util.TimeZone |
TIME_ZONE_GMT
|
Method Summary | |
static boolean |
compareDates(java.lang.String isoDateOne,
java.lang.String isoDateTwo)
Compares dates and returns true if they are equal |
static java.lang.String |
convertDateToW3CDate(java.util.Calendar cal,
boolean bDateOnly)
Converts Date object into W3C-date-formatted string. |
static java.lang.String |
convertDateToW3CDate(java.util.Date date,
boolean bDateOnly)
Deprecated. Use convertDateToW3CDate(Calendar cal, boolean bDateOnly) |
static java.util.Calendar |
convertW3CDateToCalendar(java.lang.String str,
boolean hyphenated)
|
static java.util.Calendar |
convertW3CDateToCalendar(java.lang.String str,
boolean hyphenated,
java.util.TimeZone defaultTimeZone)
|
static java.util.Date |
convertW3CDateToDate(java.lang.String str)
Parses the string with W3C-formatted date and returns java Date object. |
static java.util.Date |
convertW3CDateToDate(java.lang.String str,
boolean hyphenated)
Parses the string with W3C-formatted date and returns java Date object. |
static java.lang.String |
formatCompressedISODateTime(java.lang.String month,
java.lang.String day,
java.lang.String year)
Puts the date in compressed W3C format without validation. |
static java.lang.String |
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 |
static java.lang.String |
formatISODateTime(java.lang.String month,
java.lang.String day,
java.lang.String year)
Puts the date in W3C format without validation. |
static java.lang.String |
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. |
static java.lang.String |
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. |
static java.lang.String |
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. |
static java.lang.String |
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. |
static java.lang.String |
localISODateTime(java.lang.String isoDateTime)
Returns the date in W3C format shifted from GMT to local time. |
static java.util.Date |
parseCompressedISODateTimeNoShift(java.lang.String isoDateTime)
Parses an W3C-formatted date String into a Date object. |
static java.util.Date |
parseISODateTimeNoShift(java.lang.String isoDateTime)
Parses an W3C-formatted date String into a Date object. |
static java.lang.String |
validateCompressedISODateTime(java.lang.String newDate,
java.lang.String min,
java.lang.String max)
Validates a date and returns it in GMT time zone. |
static java.lang.String |
validateISODateTime(java.lang.String newDate,
java.lang.String min,
java.lang.String max)
Validates a date and returns it in GMT time zone. |
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)
Validates a date for min and max. |
static boolean |
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 |
public static final java.util.TimeZone TIME_ZONE_GMT
Method Detail |
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 localeisoDateTime
- date/time in iso gmtdateFormat
- timeFormat
-
java.lang.Exception
public static java.lang.String getFormattedDate(java.util.Locale locale, java.lang.String isoDateTime) throws java.lang.Exception
locale
- The Locale object specifying the localeisoDateTime
- The W3C date/time value in GTM time zone
java.lang.Exception
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.encodeLocaleisoDateTime
- The W3C date/time value in GTM time zone
java.lang.Exception
public static java.lang.String getFormattedDateTime(java.util.Locale locale, java.lang.String isoDateTime) throws java.lang.Exception
locale
- The Locale object specifying the localeisoDateTime
- The W3C date/time value in GMT time zone
java.lang.Exception
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.encodeLocaleisoDateTime
- The W3C date/time value in GMT time zone
java.lang.Exception
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.Exception
public static java.lang.String formatISODateTime(java.lang.String month, java.lang.String day, java.lang.String year)
month
- The month, 2 chars or lessday
- The day, 2 chars or lessyear
- The year, 4 chars or less
public static java.lang.String formatCompressedISODateTime(java.lang.String month, java.lang.String day, java.lang.String year)
month
- The month, 2 chars or lessday
- The day, 2 chars or lessyear
- The year, 4 chars or less
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 formatmax
- The maximum date value in W3C format
java.lang.Exception
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 timemin
- The minimum date value in W3C formatmax
- The maximum date value in W3C format
java.lang.Exception
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 timemin
- The minimum date value in W3C formatmax
- The maximum date value in W3C format
java.lang.Exception
public static boolean validateMonthDayYear(int month, int day, int year)
month
- Integer holding the monthday
- Integer holding the dayyear
- Integer holding the year
public static java.util.Date parseISODateTimeNoShift(java.lang.String isoDateTime) throws java.text.ParseException
isoDateTime
- The W3C formatted date/time
java.text.ParseException
public static java.util.Date parseCompressedISODateTimeNoShift(java.lang.String isoDateTime) throws java.text.ParseException
isoDateTime
- The W3C formatted date/time
java.text.ParseException
public static java.lang.String convertDateToW3CDate(java.util.Date date, boolean bDateOnly)
public static java.lang.String convertDateToW3CDate(java.util.Calendar cal, boolean bDateOnly)
cal
- an object of type java.util.datebDateOnly
- 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.
public static boolean compareDates(java.lang.String isoDateOne, java.lang.String isoDateTwo)
isoDateOne
- First date to compareisoDateTwo
- Second date to compare
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.public static java.util.Calendar convertW3CDateToCalendar(java.lang.String str, boolean hyphenated) throws WcmException
WcmException
public static java.util.Calendar convertW3CDateToCalendar(java.lang.String str, boolean hyphenated, java.util.TimeZone defaultTimeZone) throws WcmException
WcmException
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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |