|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sibvisions.util.type.DateUtil
public class DateUtil
The DateUtil is a utility class for date conversion and for formatting dates
as string.
| Constructor Summary | |
|---|---|
DateUtil()
Constructs a new instance of DateUtil with default date format. |
|
DateUtil(DateFormat pDateFormat)
Deprecated. since 2.7, use DateUtil(String) or DateUtil(String, Locale) instead.
Using this function might lead to undefined behavior because of a new caching mechanism based on
the Locale of the DateUtil. However, there is no way to extract the Locale that has been used from
a DateFormat, so it is always treated as using LocaleUtil.getDefault(). |
|
DateUtil(String pDatePattern)
Constructs a new instance of DateUtil that supports empty Strings and null values. |
|
DateUtil(String pDatePattern,
Locale pLocale)
Constructs a new instance of DateUtil that supports empty Strings and null values. |
|
| Method Summary | |
|---|---|
static Date |
convert(Date pDate,
String pFromTimeZone,
String pToTimeZone)
Converts a date from one timezone to another timezone. |
static Date |
convert(Date pDate,
TimeZone pFromTimeZone,
TimeZone pToTimeZone)
Converts a date from one timezone to another timezone. |
String |
format(Date pDate)
Formats the date to text. |
static String |
format(Date pDate,
String pFormat)
Formats a Date into a date/time string. |
static String |
format(long pDate,
String pFormat)
Formats a time string. |
static Date |
getDate(int pDay,
int pMonth,
int pYear,
int pHour,
int pMinutes,
int pSeconds)
Creates a new date instance. |
DateFormat |
getDateFormat()
Deprecated. |
String |
getDatePattern()
Gets the date format pattern. |
boolean |
isStrictFormatCheck()
Strict format check defines whether the set pattern should be exactly by format, or be more flexibel in analysing the given date. |
Date |
parse(String pText)
Parses the date from text. |
void |
setDateFormat(DateFormat pDateFormat)
Deprecated. since 2.7, use setDatePattern(String) or setDatePattern(String, Locale) instead.
Using this function might lead to undefined behavior because of a new caching mechanism based on
the Locale of the DateUtil. However, there is no way to extract the Locale that has been used from
a DateFormat, so it is always treated as using LocaleUtil.getDefault(). |
void |
setDatePattern(String pDatePattern)
Sets the date format pattern. |
void |
setDatePattern(String pDatePattern,
Locale pLocale)
Sets the date format pattern. |
void |
setStrictFormatCheck(boolean pStrictFormatCheck)
Strict format check defines whether the set pattern should be exactly by format, or be more flexibel in analysing the given date. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DateUtil()
DateUtil with default date format.
@Deprecated public DateUtil(DateFormat pDateFormat)
DateUtil(String) or DateUtil(String, Locale) instead.
Using this function might lead to undefined behavior because of a new caching mechanism based on
the Locale of the DateUtil. However, there is no way to extract the Locale that has been used from
a DateFormat, so it is always treated as using LocaleUtil.getDefault().
DateUtil that supports empty Strings and null values.
pDateFormat - the formatter that should support empty Strings and null valuespublic DateUtil(String pDatePattern)
DateUtil that supports empty Strings and null values.
As no Locale is specified, LocaleUtil.getDefault() will always be used.
pDatePattern - the pattern that should support empty Strings and null values. null to use the default.
public DateUtil(String pDatePattern,
Locale pLocale)
DateUtil that supports empty Strings and null values.
pDatePattern - the pattern that should support empty Strings and null values. null to use the default.pLocale - the Locale to use. null to always use LocaleUtil.getDefault().| Method Detail |
|---|
public Date parse(String pText)
throws ParseException
pText - the text.
ParseException - if there is an error in the conversionpublic String format(Date pDate)
pDate - the date.
@Deprecated public DateFormat getDateFormat()
public void setDateFormat(DateFormat pDateFormat)
setDatePattern(String) or setDatePattern(String, Locale) instead.
Using this function might lead to undefined behavior because of a new caching mechanism based on
the Locale of the DateUtil. However, there is no way to extract the Locale that has been used from
a DateFormat, so it is always treated as using LocaleUtil.getDefault().
pDateFormat - the date format.public String getDatePattern()
setDatePattern(String),
setDatePattern(String, Locale)public void setDatePattern(String pDatePattern)
This function will reset the currently set Locale to null,
which means that LocaleUtil.getDefault() is used.
pDatePattern - the date format pattern.setDatePattern(String, Locale)
public void setDatePattern(String pDatePattern,
Locale pLocale)
pDatePattern - the date format pattern.pLocale - the Locale to use. null to always use LocaleUtil.getDefault().setDatePattern(String)public boolean isStrictFormatCheck()
public void setStrictFormatCheck(boolean pStrictFormatCheck)
pStrictFormatCheck - true, if format should be checked strict.
public static String format(long pDate,
String pFormat)
pDate - the time (in millis since 01.01.1970 00:00) value to be formatted into a time stringpFormat - the format
SimpleDateFormat
public static String format(Date pDate,
String pFormat)
pDate - the time value to be formatted into a time stringpFormat - the format
SimpleDateFormat
public static Date getDate(int pDay,
int pMonth,
int pYear,
int pHour,
int pMinutes,
int pSeconds)
pDay - the day of monthpMonth - the monthpYear - the yearpHour - the hour of daypMinutes - the minutespSeconds - the seconds
public static Date convert(Date pDate,
String pFromTimeZone,
String pToTimeZone)
pDate - the datepFromTimeZone - the timezone of the datepToTimeZone - the expected timezone
public static Date convert(Date pDate,
TimeZone pFromTimeZone,
TimeZone pToTimeZone)
pDate - the datepFromTimeZone - the timezone of the datepToTimeZone - the expected timezone
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||