public class DateUtils extends Object
| Constructor and Description |
|---|
DateUtils() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
public static SimpleDateFormat getNoninteractiveDateFormat()
SimpleDateFormatpublic static SimpleDateFormat getInteractiveDateFormat()
SimpleDateFormatpublic 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 conformCopyright © 2016 Eclipse Stardust. All Rights Reserved.