@ThreadSafe public class CalendarDateFormatter extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
isodatePatternString |
| Constructor and Description |
|---|
CalendarDateFormatter() |
| Modifier and Type | Method and Description |
|---|---|
static CalendarDate |
isoStringToCalendarDate(Calendar calt,
String iso)
Convert an ISO formatted String to a CalendarDate.
|
static Date |
isoStringToDate(String iso) |
static void |
main(String[] arg) |
static Date |
parseISODate(String iso)
Deprecated.
As of 4.3.10 use
isoStringToDate(String) instead |
static String |
toDateString(CalendarDate cd) |
static String |
toDateStringPresent() |
static String |
toDateTimeString(CalendarDate cd) |
static String |
toDateTimeString(Date date) |
static String |
toDateTimeStringISO(CalendarDate cd) |
static String |
toDateTimeStringISO(Date d) |
static String |
toDateTimeStringPresent() |
public static final String isodatePatternString
public static String toDateTimeStringISO(CalendarDate cd)
public static String toDateTimeString(CalendarDate cd)
public static String toDateTimeStringPresent()
public static String toDateString(CalendarDate cd)
public static String toDateStringPresent()
@Deprecated public static Date parseISODate(String iso)
isoStringToDate(String) insteadiso - ISO 8601 date Stringpublic static CalendarDate isoStringToCalendarDate(Calendar calt, String iso) throws IllegalArgumentException
calt - calendar, may be null for default calendar (Calendar.getDefault())iso - ISO 8601 date String
possible forms for W3C profile of ISO 8601
Year:
YYYY (eg 1997)
Year and month:
YYYY-MM (eg 1997-07)
Complete date:
YYYY-MM-DD (eg 1997-07-16)
Complete date plus hours and minutes:
YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00)
Complete date plus hours, minutes and seconds:
YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)
Complete date plus hours, minutes, seconds and a decimal fraction of a second
YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)
where:
YYYY = four-digit year
MM = two-digit month (01=January, etc.)
DD = two-digit day of month (01 through 31)
hh = two digits of hour (00 through 23) (am/pm NOT allowed)
mm = two digits of minute (00 through 59)
ss = two digits of second (00 through 59)
s = one or more digits representing a decimal fraction of a second
TZD = time zone designator (Z or +hh:mm or -hh:mm)
except:
You may use a space instead of the 'T'
The year may be preceeded by a '+' (ignored) or a '-' (makes the date BCE)
The date part uses a '-' delimiter instead of a fixed number of digits for each field
The time part uses a ':' delimiter instead of a fixed number of digits for each field
IllegalArgumentException - if the String is not a valid ISO 8601 datepublic static Date isoStringToDate(String iso) throws IllegalArgumentException
IllegalArgumentExceptionpublic static void main(String[] arg)
Copyright © 1999-2012 UCAR/Unidata. All Rights Reserved.