public class LcTime extends Object
The time is internally represented as the number of milliseconds from the epoch, which is midnight 00:00:00 GMT, i.e., time 1 is midnight GMT.
Time picture patterns are used to parse and format time strings. Here are the metasymbols that form valid time picture patterns:
LcTime to reformat a
time string
import com.adobe.xfa.ut.LcTime; // for defn of LcTime.
...
String loc = "en_ca"
String fmt = LcTime.DEFAULT_TIME_FMT;
LcTime now = new LcTime(loc);
now.setLocalTime();
now += 2 * LcTime.MILLISPERHOUR;
if (now.isValid())
System.out.println(now.format("h:MM:SS:FFF A Z"));
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_TIME_FMT
Default LcTime pattern string for English_US locale: h:MM:SS A.
|
static int |
MILLISPERDAY |
static int |
MILLISPERHOUR |
static int |
MILLISPERMINUTE |
static int |
MILLISPERSECOND |
static String |
TIME_FMT1
ISO8601/XFA time pattern string: HHMMSS.FFFz.
|
static String |
TIME_FMT2
Alternate ISO8601/XFA time pattern string: HH:MM:SS.FFFzz.
|
static String |
TIME_PICTURE_SYMBOLS
LcTime pattern symbols: hkHKMSFAzZ.
|
| Constructor and Description |
|---|
LcTime(int millis,
String locale)
Instantiates an LcTime object from the number of milliseconds from the
epoch and in the locale given.
|
LcTime(LcTime oTime)
Instantiates an LcTime object from an existing LcTime object
|
LcTime(String locale)
Instantiates an LcTime object from today's Greenwich Mean time and in the
locale given.
|
LcTime(String time,
String pat,
String locale)
Instantiates an LcTime object from the given time in the pattern given and
in the locale given.
|
| Modifier and Type | Method and Description |
|---|---|
LcTime |
add(int millis)
Adds the given milliseconds to this object.
|
LcTime |
asgn(LcTime oTime)
Assigns the given LcTime object to this object.
|
String |
format(String pat)
Formats this object given a time pattern string.
|
int |
getDays()
Gets this lcTime object's difference in days from Greenwich Mean.
|
int |
getHour()
Gets the hour of the day.
|
static String |
getLocalTimeFormat(int style,
String locale)
Gets the localized time pattern in the given style for the given locale.
|
int |
getMillis()
Gets the number of milliseconds since the epoch.
|
int |
getMilliSecond()
Gets the fraction of the second.
|
int |
getMinute()
Gets the minute of the hour.
|
int |
getSecond()
Gets the second of the hour.
|
static String |
getTimeFormat(int style,
String locale)
Gets the time pattern in the given style for the given locale.
|
int |
getTimeZone()
Get timezone in minutes west of Greenwich
|
boolean |
isValid()
Determines if this object is valid.
|
void |
setGMTime()
Sets this object to operate on Greenwich Mean time, which is the
default.
|
void |
setLocalTime()
Sets this object to operate on local time as opposed to the
default, which is Greenwich Mean time.
|
String |
toString()
Formats this object according to the default pattern.
|
public static final String DEFAULT_TIME_FMT
public static final int MILLISPERDAY
public static final int MILLISPERHOUR
public static final int MILLISPERMINUTE
public static final int MILLISPERSECOND
public static final String TIME_FMT1
public static final String TIME_FMT2
public static final String TIME_PICTURE_SYMBOLS
public LcTime(String locale)
locale - a locale string. When empty, it will default to the default
locale.public LcTime(int millis,
String locale)
millis - the number of milliseconds from epoch.locale - a locale string. When empty, it will default to the default
locale.public LcTime(String time, String pat, String locale)
time - a time string.pat - a time pattern string used to parse the given time.locale - a locale string. When empty, it will default to the default
locale.public LcTime(LcTime oTime)
oTime - an existing LcTime objectpublic LcTime add(int millis)
millis - the number of milliseconds to add.public LcTime asgn(LcTime oTime)
oTime - an existing LcTime object.public String format(String pat)
pat - a time pattern string.public int getDays()
public int getHour()
public static String getLocalTimeFormat(int style, String locale)
style - a style value:
locale - a locale string. When empty, it will default to the default
locale.public int getMillis()
public int getMilliSecond()
public int getMinute()
public int getSecond()
public static String getTimeFormat(int style, String locale)
style - a style value:
locale - a locale string. When empty, it will default to the default
locale.public int getTimeZone()
public boolean isValid()
public void setGMTime()
public void setLocalTime()
Copyright © 2010 - 2020 Adobe. All Rights Reserved