|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.eclipse.stardust.common.DateUtils
public class DateUtils
This utility class provides convenience methods for date / time related conversions and checks.
| Constructor Summary | |
|---|---|
DateUtils()
|
|
| Method Summary | |
|---|---|
static Date |
businessDateToDate(Calendar cal)
|
static long |
businessDateToTimestamp(Calendar cal)
|
static Calendar |
dateToBusinessDate(Date businessDate)
|
static String |
formatDate(Date date)
Returns a String representation for given Date object using date formatter with default style for default locale. |
static String |
formatDateTime(Date date)
Returns a String representation for given Date object. |
static String |
formatDurationAsString(double durationInHours)
Returns the given duration in hours as formatted string. Format is: hours:minutes:seconds h Example : 1:05:20 h |
static String |
formatTime(Date date)
Returns a String representation for given Date object using time formatter with default style for default locale. |
static SimpleDateFormat |
getInteractiveDateFormat()
Factory which creates a SimpleDateFormat instance which can be used to format Dates to strings with pattern "yyyy/MM/dd hh:mm:ss". |
static SimpleDateFormat |
getNoninteractiveDateFormat()
Factory which creates a SimpleDateFormat instance which can be used to format Dates to strings with pattern "yyyy/MM/dd hh:mm:ss:SSS". |
static long |
getTimestamp(Date date,
long def)
Returns number of milliseconds since January 1, 1970, 00:00:00 GMT represented by given Date object. |
static boolean |
isValidISODateFormat(String date)
Checks if the input date conforms to an ISO date pattern (e.g. |
static boolean |
isValidNonInteractiveFormat(String date)
Checks if the input date conforms to the non-interactive date format yyyy/MM/dd hh:mm:ss:SSS. |
static void |
resetTimeComponent(Calendar calendar)
|
static Calendar |
timestampToBusinessDate(long timestamp)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DateUtils()
| Method Detail |
|---|
public static SimpleDateFormat getNoninteractiveDateFormat()
SimpleDateFormatpublic static SimpleDateFormat getInteractiveDateFormat()
SimpleDateFormat
public static long getTimestamp(Date date,
long def)
date - the Date object.def - the default value used if Date object is null.
Date.getTime()public static String formatDateTime(Date date)
date - the Date object.
DateFormat.getDateInstance(),
DateFormat.getTimeInstance()public static String formatDate(Date date)
date - the Date object.
DateFormat.getDateInstance()public static String formatTime(Date date)
date - the Date object.
DateFormat.getTimeInstance()public static String formatDurationAsString(double durationInHours)
durationInHours - the duration in hours.
public static boolean isValidISODateFormat(String date)
date - String representation of date.
true if the date conforms to an ISO date pattern,
false if it does not conformpublic static boolean isValidNonInteractiveFormat(String date)
date - String representation of date.
true if the date conforms to this pattern,
false if it does not conformpublic static void resetTimeComponent(Calendar calendar)
public static long businessDateToTimestamp(Calendar cal)
public static Date businessDateToDate(Calendar cal)
public static Calendar dateToBusinessDate(Date businessDate)
public static Calendar timestampToBusinessDate(long timestamp)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||