public class LcDate extends Object
The date is internally represented as the number of days from the epoch, which is Jan 1, 1900, i.e., day 1 is Jan 1, 1900.
Date picture patterns are used to parse and format date strings. Here are the metasymbols that form valid date picture patterns:
LcDate to reformat
a date string
import com.adobe.xfa.ut.LcDate; // for defn of LcDate.
...
LcDate today = new LcDate("", DEFAULT_CENTURY_SPLIT);
String s = today.format("EEEE', the 'D' of 'MMMM', 'YYYY");
System.out.println(s);
LcDate date = new LcDate("28/2/2000", "D/M/YYYY",
"", DEFAULT_CENTURY_SPLIT);
date += 30;
if (date.isValid())
System.out.println(date.format(LcDate.getDateFormat(4, "pt_BR")););
| Modifier and Type | Field and Description |
|---|---|
static String |
DATE_FMT1
ISO8601/XFA date pattern string: YYYYMMDD.
|
static String |
DATE_FMT2
Alternate ISO8601/XFA date pattern string: YYYY-MM-DD.
|
static String |
DATE_PICTURE_SYMBOLS
LcDate pattern symbols: DJMEY.
|
static int |
DEFAULT_CENTURY_SPLIT
Default century split year: 30.
|
static String |
DEFAULT_DATE_FMT
Default LcDate pattern string for English_US locale: MMM D, YYYY.
|
| Constructor and Description |
|---|
LcDate(int days,
String locale,
int centurySplit)
Instantiates an LcDate object from the given number of days from the
epoch and in the locale given.
|
LcDate(String locale,
int centurySplit)
Instantiates an LcDate object from today's date and in the locale given.
|
LcDate(String date,
String pat,
String locale,
int centurySplit)
Instantiates an LcDate object from the given date in the pattern given
and in the locale given.
|
| Modifier and Type | Method and Description |
|---|---|
LcDate |
add(int nDays)
Adds the given number of days to this object.
|
String |
format(String pat)
Formats this object according to the given a date pattern string.
|
static String |
getDateFormat(int style,
String locale)
Gets the date pattern in the given style for the given locale.
|
int |
getDays()
Gets the number of days since the epoch.
|
int |
getISOWeek()
Gets the ISO8601 week of the year.
|
int |
getISOYear()
Gets the ISO8601 year of the era.
|
static String |
getLocalDateFormat(int style,
String locale)
Gets the localized date pattern in the given style for the given locale.
|
int |
getMonth()
Gets the month of the year.
|
int |
getMonthDay()
Gets the day of the month.
|
int |
getWeekDay()
Gets the day of the week.
|
int |
getWeekMonth()
Gets the week of the month.
|
int |
getYear()
Gets the year of the era.
|
int |
getYearDay()
Gets the day of the year.
|
boolean |
isValid()
Determines if this object is valid.
|
void |
setGMDate()
Sets this object to operate on Greenwich Mean date, which is the
default.
|
void |
setLocalDate()
Sets this object to operate on local date as opposed to Greenwich
Mean date.
|
String |
toString()
Formats this object according to the default pattern.
|
public static final String DATE_FMT1
public static final String DATE_FMT2
public static final String DATE_PICTURE_SYMBOLS
public static final int DEFAULT_CENTURY_SPLIT
public static final String DEFAULT_DATE_FMT
public LcDate(int days,
String locale,
int centurySplit)
days - the number of days from the epoch.locale - a locale string. When empty, it will default to the default
locale.centurySplit - a century split year.public LcDate(String locale, int centurySplit)
locale - a locale string. When empty, it will default to the default
locale.centurySplit - a century split year.public LcDate(String date, String pat, String locale, int centurySplit)
date - a date string.pat - a date pattern string used to parse the given date.locale - a locale string. When empty, it will default to the default
locale.centurySplit - a century split year.public static String getDateFormat(int style, String locale)
style - a style value:
locale - a locale string. When empty, it will default
to the default locale.public static String getLocalDateFormat(int style, String locale)
style - a style value:
locale - a locale string. When empty, it will default
to the default locale.public LcDate add(int nDays)
nDays - the number of days to add.public String format(String pat)
pat - a date pattern string.public int getDays()
public int getISOWeek()
public int getISOYear()
public int getMonth()
public int getMonthDay()
public int getWeekDay()
public int getWeekMonth()
public int getYear()
public int getYearDay()
public boolean isValid()
public void setGMDate()
public void setLocalDate()
Copyright © 2010 - 2020 Adobe. All Rights Reserved