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