public final class DateUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DATE_FORMAT
Date format used for parsing.
|
static String |
DATE_TIME_FORMAT
Date/time format used for parsing.
|
static String |
TIME_FORMAT
Time format used for parsing.
|
| Modifier and Type | Method and Description |
|---|---|
static String |
getDateString(Calendar calendar)
Formats the date of a Calendar instance to a String.
|
static String |
getDateString(Calendar calendar,
Locale locale)
Formats the date of a Calendar instance to a String.
|
static String |
getDateTimeString(Calendar calendar)
Formats the date and time time of a Calendar instance to a String.
|
static String |
getDateTimeString(Calendar date,
Calendar time)
Formats the date and time time of a Calendar instance to a String.
|
static String |
getDateTimeString(Calendar date,
Calendar time,
Locale locale)
Formats the date and time time of a Calendar instance to a String.
|
static String |
getDateTimeString(Calendar calendar,
Locale locale)
Formats the date and time time of a Calendar instance to a String.
|
static String |
getTimeString(Calendar calendar)
Formats the time of a Calendar instance to a String.
|
static String |
getTimeString(Calendar calendar,
Locale locale)
Formats the time of a Calendar instance to a String.
|
static Calendar |
parseDate(String date,
boolean adjustToLocalTimeZone)
Parses a date given as a string.
|
public static final String DATE_FORMAT
public static final String TIME_FORMAT
public static final String DATE_TIME_FORMAT
public static Calendar parseDate(String date, boolean adjustToLocalTimeZone) throws IndexOutOfBoundsException, NumberFormatException
DATE_TIME_FORMAT.date - a date formatted as a stringadjustToLocalTimeZone - if result should be adjusted to local time zone or notIndexOutOfBoundsException - if the String is too shortNumberFormatException - if a date/time component is out of range or cannot be parsedpublic static String getDateTimeString(Calendar date, Calendar time)
date - the date as a java.util.Calendartime - the time as a java.util.Calendarpublic static String getDateTimeString(Calendar date, Calendar time, Locale locale)
date - the date as a java.util.Calendartime - the time as a java.util.Calendarlocale - localepublic static String getDateTimeString(Calendar calendar)
calendar - the date as a java.util.Calendarpublic static String getDateTimeString(Calendar calendar, Locale locale)
calendar - the date as a java.util.Calendarlocale - localepublic static String getDateString(Calendar calendar)
calendar - the date as a java.util.Calendarpublic static String getDateString(Calendar calendar, Locale locale)
calendar - the date as a java.util.Calendarlocale - localepublic static String getTimeString(Calendar calendar)
calendar - the date as a java.util.Calendarpublic static String getTimeString(Calendar calendar, Locale locale)
calendar - the date as a java.util.Calendarlocale - localeCopyright © 2005–2020. All rights reserved.