public enum VCardDateFormat extends Enum<VCardDateFormat>
Enum Constant and Description |
---|
DATE_BASIC
Example: 20120701
|
DATE_EXTENDED
Example: 2012-07-01
|
DATE_TIME_BASIC
Example: 20120701T142110-0500
|
DATE_TIME_EXTENDED
Example: 2012-07-01T14:21:10-05:00
|
HCARD_DATE_TIME
Example: 2012-07-01T14:21:10-0500
|
UTC_DATE_TIME_BASIC
Example: 20120701T192110Z
|
UTC_DATE_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.
|
static VCardDateFormat |
find(String dateStr)
Determines the ISO format a date string is in.
|
String |
format(Date date)
Formats a date in this vCard date format.
|
String |
format(Date date,
TimeZone timezone)
Formats a date in this vCard date format.
|
DateFormat |
getDateFormat()
Builds a
DateFormat object for parsing and formating dates in
this format. |
DateFormat |
getDateFormat(TimeZone timezone)
Builds a
DateFormat object for parsing and formating dates in
this format. |
boolean |
matches(String dateStr)
Determines whether a date string is in this ISO format.
|
static Date |
parse(String dateStr)
Parses a date string.
|
static TimeZone |
parseTimeZoneId(String timezoneId)
Gets the
TimeZone object that corresponds to the given ID. |
static VCardDateFormat |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static VCardDateFormat[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final VCardDateFormat DATE_BASIC
public static final VCardDateFormat DATE_EXTENDED
public static final VCardDateFormat DATE_TIME_BASIC
public static final VCardDateFormat DATE_TIME_EXTENDED
public static final VCardDateFormat UTC_DATE_TIME_BASIC
public static final VCardDateFormat UTC_DATE_TIME_EXTENDED
public static final VCardDateFormat HCARD_DATE_TIME
protected final String formatStr
SimpleDateFormat
format string used for parsing dates.public static VCardDateFormat[] values()
for (VCardDateFormat c : VCardDateFormat.values()) System.out.println(c);
public static VCardDateFormat 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 boolean matches(String dateStr)
dateStr
- the date stringpublic DateFormat getDateFormat()
DateFormat
object for parsing and formating dates in
this format.DateFormat
objectpublic DateFormat getDateFormat(TimeZone timezone)
DateFormat
object for parsing and formating dates in
this 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 VCardDateFormat find(String dateStr)
dateStr
- the date string (e.g. "20140322T120000Z")public 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 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")This software is published under the BSD license. Copyright © 2003-${build.year}, CRIXP AG, Switzerland, All rights reserved. Use is subject to license terms.