|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.axiondb.util.DateTimeUtils
public final class DateTimeUtils
Methods to support manipulation and conversion of date, time and timestamp values.
Field Summary | |
---|---|
static int |
DAY
Constant representing day interval |
static int |
HOUR
Constant representing hour time interval |
static int |
MILLISECOND
Constant representing millisecond time interval |
static int |
MINUTE
Constant representing minute time interval |
static int |
MONTH
Constant representing month interval |
static int |
QUARTER
Constant representing quarter interval |
static int |
SECOND
Constant representing second time interval |
static int |
WEEK
Constant representing week interval |
static int |
YEAR
Constant representing year interval |
Constructor Summary | |
---|---|
DateTimeUtils()
|
Method Summary | |
---|---|
static java.lang.String |
convertToChar(java.sql.Timestamp timestamp,
java.lang.String formatStr)
Creates a String representation of the given Timestamp object, using the given format string as a template and the current Axion time zone. |
static java.lang.String |
convertToChar(java.sql.Timestamp timestamp,
java.lang.String formatStr,
java.util.TimeZone timezone)
Creates a String representation of the given Timestamp object, using the given format string as a template, the given time zone, and the current default Locale. |
static java.lang.String |
convertToChar(java.sql.Timestamp timestamp,
java.lang.String formatStr,
java.util.TimeZone timezone,
java.util.Locale locale)
Creates a String representation of the given Timestamp object, using the given format string as a template, the given time zone, and the given Locale. |
static java.sql.Timestamp |
convertToTimestamp(java.lang.String dateStr,
java.lang.String formatStr)
Creates a String representation of the given Timestamp object, using the given format string as a template and the current Axion time zone. |
static java.sql.Timestamp |
convertToTimestamp(java.lang.String dateStr,
java.lang.String formatStr,
java.util.TimeZone timezone)
Creates a String representation of the given Timestamp object, using the given format string as a template and the given time zone. |
static java.sql.Timestamp |
convertToTimestamp(java.lang.String dateStr,
java.lang.String formatStr,
java.util.TimeZone timezone,
java.util.Locale locale)
Creates a String representation of the given Timestamp object, using the given format string as a template, the given time zone, and the given Locale |
static java.lang.String |
getDatePart(java.sql.Timestamp t,
java.lang.String partIdent)
Extracts the specified date/time element from the given Timestamp, using the default Locale. |
static java.lang.String |
getDatePart(java.sql.Timestamp t,
java.lang.String partIdent,
java.util.Locale locale)
Extracts the specified date/time element from the given Timestamp, using the given Locale. |
static java.lang.String |
getPartMnemonicFor(java.lang.String partString)
|
static int |
labelToCode(java.lang.String value)
Converts the given value, which represents a date or time interval, to its corresponding constant value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MILLISECOND
public static final int SECOND
public static final int MINUTE
public static final int HOUR
public static final int DAY
public static final int WEEK
public static final int MONTH
public static final int QUARTER
public static final int YEAR
Constructor Detail |
---|
public DateTimeUtils()
Method Detail |
---|
public static java.lang.String convertToChar(java.sql.Timestamp timestamp, java.lang.String formatStr) throws AxionException
timestamp
- Timestamp object to be converted to a String representationformatStr
- template describing the desired format for the String
representation of timestamp
timestamp
AxionException
- if format is invalidconvertToChar(Timestamp, String, java.util.TimeZone)
public static java.lang.String convertToChar(java.sql.Timestamp timestamp, java.lang.String formatStr, java.util.TimeZone timezone) throws AxionException
timestamp
- Timestamp object to be converted to a String representationformatStr
- template describing the desired format for the String
representation of timestamp
timezone
- TimeZone to use in interpreting the value of
timestamp
to the desired String representation
timestamp
AxionException
- if format is invalidconvertToChar(Timestamp, String)
,
convertToChar(Timestamp, String, TimeZone, Locale)
public static java.lang.String convertToChar(java.sql.Timestamp timestamp, java.lang.String formatStr, java.util.TimeZone timezone, java.util.Locale locale) throws AxionException
timestamp
- Timestamp object to be converted to a String representationformatStr
- template describing the desired format for the String
representation of timestamp
timezone
- TimeZone to use in interpreting the value of
timestamp
to the desired String representationlocale
- Locale to use in resolving date components
timestamp
AxionException
- if format is invalidconvertToChar(Timestamp, String)
,
convertToChar(Timestamp, String, TimeZone)
public static java.sql.Timestamp convertToTimestamp(java.lang.String dateStr, java.lang.String formatStr) throws AxionException
dateStr
- String representation of Timestamp to be returnedformatStr
- template describing the format of dateStr
dateStr
AxionException
- if format is invalidconvertToTimestamp(String, String, java.util.TimeZone)
,
convertToTimestamp(String, String, java.util.TimeZone, java.util.Locale)
public static java.sql.Timestamp convertToTimestamp(java.lang.String dateStr, java.lang.String formatStr, java.util.TimeZone timezone) throws AxionException
dateStr
- String representation of Timestamp to be returnedformatStr
- template describing the format of dateStr
timezone
- TimeZone to use in interpreting the value of dateStr
dateStr
AxionException
- if format is invalidconvertToTimestamp(String, String)
,
convertToTimestamp(String, String, java.util.TimeZone, java.util.Locale)
public static java.sql.Timestamp convertToTimestamp(java.lang.String dateStr, java.lang.String formatStr, java.util.TimeZone timezone, java.util.Locale locale) throws AxionException
dateStr
- String representation of Timestamp to be returnedformatStr
- template describing the format of dateStr
timezone
- TimeZone to use in interpreting the value of dateStr
locale
- Locale to use in resolving date components
dateStr
AxionException
- if format is invalidconvertToTimestamp(String, String)
,
convertToTimestamp(String, String, java.util.TimeZone)
public static java.lang.String getDatePart(java.sql.Timestamp t, java.lang.String partIdent) throws AxionException
t
- timestamp from which date/time element will be extractedpartIdent
- date part to extract, e.g., 'yyyy', 'mm', etc.
AxionException
- if error occurs during extractiongetDatePart(Timestamp, String, Locale)
public static java.lang.String getDatePart(java.sql.Timestamp t, java.lang.String partIdent, java.util.Locale locale) throws AxionException
t
- timestamp from which date/time element will be extractedpartIdent
- date part to extract, e.g., 'yyyy', 'mm', etc.locale
- Locale to use in resolving date components
AxionException
- if error occurs during extractiongetDatePart(Timestamp, String)
public static int labelToCode(java.lang.String value) throws AxionException
value
- String representation of date or time interval
value
AxionException
- if value
does not have a
corresponding constant.public static java.lang.String getPartMnemonicFor(java.lang.String partString) throws AxionException
partCode
-
AxionException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |