public class DateHelper extends Object
Constructor and Description |
---|
DateHelper() |
Modifier and Type | Method and Description |
---|---|
static String |
formatDate(Date date)
Format a date into just text representing just the date.
|
static String |
formatDate(Date date,
TimeZone timeZone)
Format a date into just text representing just the date.
|
static String |
formatDateTime(Date date)
Format a date into full date/time text.
|
static String |
formatDateTime(Date date,
TimeZone timeZone)
Format a date into full date/time text.
|
static String |
formatDateTimeInteligently(Date date)
Format date time with or without milliseconds.
|
static String |
formatDateTimeInteligently(Date date,
TimeZone timeZone)
Format date time with or without milliseconds.
|
static String |
formatMilliseconds(long milliseconds) |
static Date |
parseDate(String text)
Parse a date using the default time zone.
|
static Date |
parseDate(String text,
String timeZoneId)
Parse a date using the given time zone.
|
static Date |
parseDate(String text,
TimeZone timeZone)
Parse a date using the given time zone.
|
static Date |
parseDateTime(String text)
Parse a date and time.
|
static Date |
parseDateTime(String text,
String timeZoneId)
Parse a date and time in the given time zone.
|
static Date |
parseDateTime(String text,
TimeZone timeZone)
Parse a date and time in the given time zone.
|
static long |
parseTime(String text)
Parse a time into a number of milliseconds.
|
public static Date parseDateTime(String text) throws ParseException
text
- The date time.ParseException
- If the text isn't in a recognised
date/time format.public static Date parseDateTime(String text, String timeZoneId) throws ParseException
text
- The date time.timeZoneId
- The time zone identifier.ParseException
- If the text isn't in a recognised
date/time format.public static Date parseDateTime(String text, TimeZone timeZone) throws ParseException
text
- The date timetimeZone
- The timeZone.ParseException
- If the text isn't in a recognised
date/time format.public static Date parseDate(String text) throws ParseException
text
- A date.ParseException
- If the date isn't in the recognised
date format.public static Date parseDate(String text, String timeZoneId) throws ParseException
text
- The date text.timeZoneId
- The time zone identifier.ParseException
- If the date isn't in the recognised
date format.public static Date parseDate(String text, TimeZone timeZone) throws ParseException
text
- The date text.timeZone
- The time zone.ParseException
- If the date isn't in the recognised
date format.public static long parseTime(String text) throws ParseException
text
- The time.ParseException
- If parsing fails.public static String formatDate(Date date)
date
- The datepublic static String formatDate(Date date, TimeZone timeZone)
date
- The datetimeZone
- The time zone.public static String formatDateTime(Date date)
date
- The datepublic static String formatDateTime(Date date, TimeZone timeZone)
date
- The datetimeZone
- The time zone.public static String formatDateTimeInteligently(Date date)
date
- public static String formatDateTimeInteligently(Date date, TimeZone timeZone)
date
- timeZone
- public static String formatMilliseconds(long milliseconds)