public class CalendarUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
CalendarUtils.Format
Valid conversion formats.
|
Constructor and Description |
---|
CalendarUtils() |
Modifier and Type | Method and Description |
---|---|
static Calendar |
parseCalendar(String in,
CalendarUtils.Format format,
Locale locale,
TimeZone timeZone)
Converts the specified serialized date back into a
Calendar object. |
static Date |
parseDate(String in,
CalendarUtils.Format format,
Locale locale,
TimeZone timeZone)
Converts the specified serialized date back into a
Date object. |
static String |
serialize(Calendar c,
CalendarUtils.Format format,
Locale locale,
TimeZone timeZone)
Converts the specified calendar to a string of the specified format.
|
static String |
serialize(Date d,
CalendarUtils.Format format,
Locale locale,
TimeZone timeZone)
Converts the specified date to a string of the specified format.
|
public CalendarUtils()
public static final String serialize(Calendar c, CalendarUtils.Format format, Locale locale, TimeZone timeZone)
c
- The calendar to serialize.format
- The date format.locale
- The locale to use. If Locale.getDefault()
.timeZone
- The time zone to use. If TimeZone.getDefault()
.public static final String serialize(Date d, CalendarUtils.Format format, Locale locale, TimeZone timeZone)
format
- The date format.d
- The date to serialize.locale
- The locale to use. If Locale.getDefault()
.timeZone
- The time zone to use. If TimeZone.getDefault()
.public static final Calendar parseCalendar(String in, CalendarUtils.Format format, Locale locale, TimeZone timeZone) throws ParseException
Calendar
object.format
- The date format.in
- The serialized date.locale
- The locale to use.
If Locale.getDefault()
.timeZone
- The timezone to assume if input string doesn't contain timezone info.
If TimeZone.getDefault()
.Calendar
, or ParseException
- Malformed input encountered.public static final Date parseDate(String in, CalendarUtils.Format format, Locale locale, TimeZone timeZone) throws ParseException
Date
object.format
- The date format.in
- The serialized date.locale
- The locale to use.
If Locale.getDefault()
.timeZone
- The timezone to assume if input string doesn't contain timezone info.
If TimeZone.getDefault()
.Date
, or ParseException
- Malformed input encountered.Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.