public enum ICalDateFormat extends Enum<ICalDateFormat>
Enum Constant and Description |
---|
DATE_BASIC
Example: 20120701
|
DATE_EXTENDED
Example: 2012-07-01
|
DATE_TIME_BASIC
Example: 20120701T142110-0500
|
DATE_TIME_BASIC_WITHOUT_TZ
Example: 20120701T142110
|
DATE_TIME_EXTENDED
Example: 2012-07-01T14:21:10-05:00
|
DATE_TIME_EXTENDED_WITHOUT_TZ
Example: 2012-07-01T14:21:10
|
UTC_TIME_BASIC
Example: 20120701T192110Z
|
UTC_TIME_EXTENDED
Example: 2012-07-01T19:21:10Z
|
Modifier and Type | Field and Description |
---|---|
protected String |
formatStr
The
SimpleDateFormat format string used for parsing dates. |
Modifier and Type | Method and Description |
---|---|
static boolean |
dateHasTime(String dateStr)
Determines whether a date string has a time component.
|
static boolean |
dateHasTimezone(String dateStr)
Determines whether a date string is in UTC time or has a timezone offset.
|
String |
format(Date date)
Formats a date in this ISO format.
|
String |
format(Date date,
TimeZone timezone)
Formats a date in this ISO format.
|
DateFormat |
getDateFormat()
Builds a
DateFormat object for parsing and formating dates in
this ISO format. |
DateFormat |
getDateFormat(TimeZone timezone)
Builds a
DateFormat object for parsing and formating dates in
this ISO format. |
static boolean |
isUTC(String dateStr)
Determines if a date string is in UTC time.
|
static Date |
parse(String dateStr)
Parses an iCalendar date.
|
static Date |
parse(String dateStr,
TimeZone timezone)
Parses an iCalendar date.
|
static TimeZone |
parseTimeZoneId(String timezoneId)
Gets the
TimeZone object that corresponds to the given ID. |
static ICalDateFormat |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static ICalDateFormat[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final ICalDateFormat DATE_BASIC
public static final ICalDateFormat DATE_EXTENDED
public static final ICalDateFormat DATE_TIME_BASIC
public static final ICalDateFormat DATE_TIME_BASIC_WITHOUT_TZ
public static final ICalDateFormat DATE_TIME_EXTENDED
public static final ICalDateFormat DATE_TIME_EXTENDED_WITHOUT_TZ
public static final ICalDateFormat UTC_TIME_BASIC
public static final ICalDateFormat UTC_TIME_EXTENDED
protected final String formatStr
SimpleDateFormat
format string used for parsing dates.public static ICalDateFormat[] values()
for (ICalDateFormat c : ICalDateFormat.values()) System.out.println(c);
public static ICalDateFormat valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic DateFormat getDateFormat()
DateFormat
object for parsing and formating dates in
this ISO format.DateFormat
objectpublic DateFormat getDateFormat(TimeZone timezone)
DateFormat
object for parsing and formating dates in
this ISO format.timezone
- the timezone the date is in or null for the default
timezoneDateFormat
objectpublic String format(Date date)
date
- the date to formatpublic String format(Date date, TimeZone timezone)
date
- the date to formattimezone
- the timezone to format the date in or null for the
default timezonepublic static Date parse(String dateStr)
dateStr
- the date string to parse (e.g. "20130609T181023Z")IllegalArgumentException
- if the date string isn't in one of the
accepted ISO8601 formatspublic static Date parse(String dateStr, TimeZone timezone)
dateStr
- the date string to parse (e.g. "20130609T181023Z")timezone
- the timezone to parse the date under or null to use the
JVM's default timezone. If the date string contains its own UTC offset,
then that will be used instead.IllegalArgumentException
- if the date string isn't in one of the
accepted ISO8601 formatspublic static boolean dateHasTime(String dateStr)
dateStr
- the date string (e.g. "20130601T120000")public static boolean dateHasTimezone(String dateStr)
dateStr
- the date string (e.g. "20130601T120000Z",
"20130601T120000-0400")public static boolean isUTC(String dateStr)
dateStr
- the date string (e.g. "20130601T120000Z")public static TimeZone parseTimeZoneId(String timezoneId)
TimeZone
object that corresponds to the given ID.timezoneId
- the timezone ID (e.g. "America/New_York")Copyright © 2013–2024 Michael Angstadt. All rights reserved.