|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opensubsystems.core.util.DateUtils
public final class DateUtils
Collection of useful utilities to work with dates.
| Field Summary | |
|---|---|
static java.lang.String |
CURRENT_DATE_CODE
Constant for current date code used in date/time formulas |
static java.text.SimpleDateFormat |
DATE_FORMAT
static SimpleDateFormat for date format to display on UI and in messages. |
static java.text.SimpleDateFormat |
DATE_SQL_FORMAT
static SimpleDateFormat for date format for sql date |
static java.text.SimpleDateFormat |
DATE_STORE_FORMAT
static SimpleDateFormat for date format to store date as string so that it is stored consistently. |
static int |
DATE_TYPE_DATE
constant for date type DATE |
static int |
DATE_TYPE_DATETIME
constant for date type DATETIME |
static int |
DATE_TYPE_TIME
constant for date type TIME |
static java.text.SimpleDateFormat |
DATETIME_FORMAT
static SimpleDateFormat for datetime format to display on UI and in messages. |
static java.text.SimpleDateFormat |
DATETIME_SQL_FORMAT
static SimpleDateFormat for datetime format for sql date and time |
static java.text.SimpleDateFormat |
DATETIME_STORE_FORMAT
static SimpleDateFormat for datetime format to store date and time as string so that it is stored consistently. |
static char |
DAY_CODE
Constant for dynamic date code used in date/time formulas |
static char |
HOUR_CODE
Constant for dynamic date code used in date/time formulas |
static char |
MINUTE_CODE
Constant for dynamic date code used in date/time formulas |
static char |
MONTH_CODE
Constant for dynamic date code used in date/time formulas |
static char |
NANO_SEPARATOR
Separator we used to separate time from the nanosecond portion of the timestamp when converted to string. |
static long |
ONE_DAY
One day in milliseconds. |
static long |
ONE_HOUR
One hour in milliseconds. |
static long |
ONE_MINUTE
One minute in milliseconds. |
static long |
ONE_SECOND
One second in milliseconds. |
static char |
SECOND_CODE
Constant for dynamic date code used in date/time formulas |
static java.text.SimpleDateFormat |
TIME_FORMAT
static SimpleDateFormat for time format to display on UI and in messages. |
static java.text.SimpleDateFormat |
TIME_SQL_FORMAT
static SimpleDateFormat for time format for sql time |
static java.text.SimpleDateFormat |
TIME_STORE_FORMAT
static SimpleDateFormat for time format to store time as string so that it is stored consistently. |
static int |
TIMING_DAYS
Constant for timing type |
static int |
TIMING_HOURS
Constant for timing type |
static int |
TIMING_MINUTES
Constant for timing type |
static int |
TIMING_MONTHS
Constant for timing type |
static int |
TIMING_NEVER
Constant for timing type |
static int |
TIMING_NONE
Constant for timing type |
static int |
TIMING_WEEKS
Constant for timing type |
static int |
TIMING_YEARS
Constant for timing type |
static char |
WEEK_CODE
Constant for dynamic date code used in date/time formulas |
static char |
YEAR_CODE
Constant for dynamic date code used in date/time formulas |
| Method Summary | |
|---|---|
static int |
comparePeriods(int iPeriodType1,
int iPeriodDuration1,
int iPeriodType2,
int iPeriodDuration2)
Method to compare time periods |
static boolean |
dateAndTimeEquals(java.util.Date dtFirst,
java.util.Date dtSecond)
Check if two dates and times are equal. |
static boolean |
dateEquals(java.util.Date dtFirst,
java.util.Date dtSecond)
Check if two dates equals regardless of the time. |
static java.sql.Timestamp |
getPeriodExpiration(java.sql.Timestamp tsStartDate,
int iPeriodType,
int iPeriodDuration)
Get expiration timestamp from start date, period type and duration. |
static java.lang.String |
getStringTime(long lTimeInMiliseconds)
Function returns time string in the form MM:SS.MS from the input specified in miliseconds. |
static java.lang.String |
getTimestampAsString(java.sql.Timestamp tsTimestamp)
Convert timestamp to string including it's nanosecond portion so that it can be safely stored in variable of web page. |
static boolean |
isFunction(java.lang.String strValue)
Check if String representing date is function or date. |
static java.sql.Timestamp |
parseDateTime(java.lang.String strValue,
int iDateType,
boolean stored)
Parse date time value from given string resolving any functions or formulas the string can contain. |
static java.lang.String |
parseDayPeriod(long lPeriod)
Parse the specified period into string displaying number of days the period represents. |
static java.lang.String |
parseDayTimePeriod(long lPeriod)
Parse the specified period into string displaying date and time the period represents. |
static java.sql.Timestamp |
parseTimestamp(java.lang.String strTimestamp)
Convert string to timestamp including if available it's nanosecond portion so that it can be safely restored from variable in web page. |
static boolean |
timeEquals(java.util.Date dtFirst,
java.util.Date dtSecond,
boolean bIgnoreMilliseconds)
Check if two times equals regardless of the date. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final long ONE_SECOND
public static final long ONE_MINUTE
public static final long ONE_HOUR
public static final long ONE_DAY
public static final char NANO_SEPARATOR
public static final int TIMING_NEVER
public static final int TIMING_MINUTES
public static final int TIMING_HOURS
public static final int TIMING_DAYS
public static final int TIMING_WEEKS
public static final int TIMING_MONTHS
public static final int TIMING_YEARS
public static final int TIMING_NONE
public static final java.lang.String CURRENT_DATE_CODE
public static final char YEAR_CODE
public static final char MONTH_CODE
public static final char WEEK_CODE
public static final char DAY_CODE
public static final char HOUR_CODE
public static final char MINUTE_CODE
public static final char SECOND_CODE
public static final int DATE_TYPE_DATE
public static final int DATE_TYPE_TIME
public static final int DATE_TYPE_DATETIME
public static final java.text.SimpleDateFormat DATE_FORMAT
public static final java.text.SimpleDateFormat TIME_FORMAT
public static final java.text.SimpleDateFormat DATETIME_FORMAT
public static final java.text.SimpleDateFormat DATE_STORE_FORMAT
public static final java.text.SimpleDateFormat TIME_STORE_FORMAT
public static final java.text.SimpleDateFormat DATETIME_STORE_FORMAT
public static final java.text.SimpleDateFormat DATE_SQL_FORMAT
public static final java.text.SimpleDateFormat TIME_SQL_FORMAT
public static final java.text.SimpleDateFormat DATETIME_SQL_FORMAT
| Method Detail |
|---|
public static boolean dateEquals(java.util.Date dtFirst,
java.util.Date dtSecond)
dtFirst - - first date to compare, can be nulldtSecond - - second date to compare, can be null
public static boolean timeEquals(java.util.Date dtFirst,
java.util.Date dtSecond,
boolean bIgnoreMilliseconds)
dtFirst - - first time to compare, can be nulldtSecond - - second time to compare, can be nullbIgnoreMilliseconds - - if true milliseconds will be ignored in comparison
public static boolean dateAndTimeEquals(java.util.Date dtFirst,
java.util.Date dtSecond)
dtFirst - - first date time to compare, can be nulldtSecond - - second date time to compare, can be null
public static boolean isFunction(java.lang.String strValue)
strValue - - string representation of date or date function
public static java.sql.Timestamp parseDateTime(java.lang.String strValue,
int iDateType,
boolean stored)
throws OSSInvalidDataException
strValue - - string representation of date or date functioniDateType - - date type code, one of the DATE_TYPE_XXX constantsstored - - flag if Date should be parsed using format used for
storage or for display
OSSInvalidDataException - - error during parsingpublic static java.lang.String parseDayPeriod(long lPeriod)
lPeriod - - period in miliseconds
public static java.lang.String parseDayTimePeriod(long lPeriod)
lPeriod - - preiod in miliseconds
public static java.sql.Timestamp getPeriodExpiration(java.sql.Timestamp tsStartDate,
int iPeriodType,
int iPeriodDuration)
tsStartDate - - start date of period countingiPeriodType - - one of the period type constant TIMING_XXXiPeriodDuration - - period duration, number of time units specified
by period type
public static int comparePeriods(int iPeriodType1,
int iPeriodDuration1,
int iPeriodType2,
int iPeriodDuration2)
iPeriodType1 - - first period type, one of the period type constant
TIMING_XXXiPeriodDuration1 - - first period durationiPeriodType2 - - second period type, one of the period type constant
TIMING_XXXiPeriodDuration2 - - second period duration
public static java.lang.String getTimestampAsString(java.sql.Timestamp tsTimestamp)
tsTimestamp - - timestamp to convert
public static java.sql.Timestamp parseTimestamp(java.lang.String strTimestamp)
throws java.lang.NumberFormatException
strTimestamp - - timestamp to convert
java.lang.NumberFormatException - - problem parsing the stringpublic static java.lang.String getStringTime(long lTimeInMiliseconds)
lTimeInMiliseconds - - time in miliseconds
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||