public class QDate
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DAY |
static int |
DAY_OF_MONTH |
static int |
DAY_OF_WEEK |
static int |
HOUR |
static int |
MILLISECOND |
static int |
MINUTE |
static int |
MONTH |
static int |
SECOND |
static int |
TIME |
static int |
TIME_ZONE |
static int |
YEAR |
Constructor and Description |
---|
QDate()
Creates the date for GMT.
|
QDate(boolean isLocal)
Creates the date form local or GMT.
|
QDate(long time)
Creates the date for GMT.
|
QDate(long year,
long month,
long dayOfMonth)
Creates the date for the local time zone.
|
QDate(java.util.TimeZone zone)
Creates the date from local or GMT.
|
QDate(java.util.TimeZone zone,
long now)
Creates the date from local or GMT.
|
Modifier and Type | Method and Description |
---|---|
static QDate |
allocateGmtDate() |
static QDate |
allocateLocalDate() |
java.lang.Object |
clone() |
static QDate |
createLocal()
Creates a local calendar.
|
CharBuffer |
format(CharBuffer cb,
java.lang.String format)
Format the date using % escapes:
%aday of week (short)
%Aday of week (verbose)
%bmonth name (short)
%Bmonth name (verbose)
%cJava locale date
%dday of month (two-digit)
%F%Y-%m-%d
%H24-hour (two-digit)
%I12-hour (two-digit)
%jday of year (three-digit)
%l12-hour (one-digit prefixed by space)
%mmonth (two-digit)
%Mminutes
%pam/pm
%PAM/PM
%Sseconds
%smilliseconds
%xJava locale short date
%XJava locale short time
%Wweek in year (three-digit)
%wday of week (one-digit)
%yyear (two-digit)
%Yyear (four-digit)
%Ztime zone (name)
%ztime zone (+/-0800)
|
java.lang.String |
format(java.lang.String format)
Formats the current date.
|
static java.lang.String |
formatGMT(long gmtTime)
Formats a date, using the default time format.
|
static java.lang.String |
formatGMT(long gmtTime,
java.lang.String format)
Formats a date.
|
static java.lang.String |
formatISO8601(long gmtTime) |
static CharBuffer |
formatLocal(CharBuffer cb,
long gmtTime,
java.lang.String format)
Formats a time in the local time zone.
|
static java.lang.String |
formatLocal(long gmtTime)
Formats a time in the local time zone, using the default format.
|
static java.lang.String |
formatLocal(long gmtTime,
java.lang.String format)
Formats a time in the local time zone.
|
static void |
freeGmtDate(QDate date) |
static void |
freeLocalDate(QDate date) |
long |
get(int field)
Gets values based on a field.
|
java.util.Calendar |
getCalendar()
Return the current time as a java.util.Calendar.
|
int |
getDayOfMonth()
Returns the day of the month, based on 1 for the first of the month.
|
int |
getDayOfWeek()
Returns the day of the week.
|
int |
getDayOfYear()
Returns the day of the year, based on 0 for January 1.
|
int |
getDaysInMonth()
Returns the day of the month, based on 1 for the first of the month.
|
static QDate |
getGlobalDate()
Global date must be synchronized before you can do anything on it.
|
long |
getGMTTime()
Returns the time in milliseconds since the epoch.
|
int |
getHour()
Returns the hour.
|
long |
getLocalTime()
Returns the time in milliseconds since the epoch.
|
java.util.TimeZone |
getLocalTimeZone()
Returns the current time zone.
|
long |
getMillisecond()
Returns the millisecond.
|
int |
getMinute()
Returns the minute.
|
int |
getMonth()
Returns the month in the year.
|
int |
getSecond()
Returns the second.
|
long |
getTimeOfDay()
Returns the milliseconds since the beginning of the day.
|
int |
getWeek()
Returns the week in the year.
|
int |
getYear()
Returns the year.
|
java.lang.String |
getZoneName()
Returns the name of the timezone
|
long |
getZoneOffset()
Returns the time zone offset for that particular day.
|
boolean |
isDST()
Returns true for DST
|
boolean |
isLeapYear() |
long |
parseDate(java.lang.String string) |
long |
parseLocalDate(java.lang.String string) |
java.lang.String |
printDate() |
void |
printDate(CharBuffer cb) |
void |
printDate(WriteStream os)
Prints the date to a stream.
|
java.lang.String |
printISO8601()
Prints the time in ISO 8601
|
java.lang.String |
printISO8601Date()
Prints just the date component of ISO 8601
|
java.lang.String |
printLocaleDate() |
void |
printRFC2822(CharBuffer cb) |
java.lang.String |
printShortLocaleDate()
Returns a date in M/dd/yy format (i.e.
|
java.lang.String |
printShortLocaleTime()
Returns a date in H:mm:ss PM format.
|
long |
set(int field,
long value)
Sets values based on a field.
|
long |
setDate(long year,
long month,
long day)
Sets date in the local time.
|
void |
setDayOfMonth(int day)
sets the day of the month based on 1 for the first of the month.
|
void |
setGMTTime(long time)
Sets the time in milliseconds since the epoch and calculate
the internal variables.
|
void |
setHour(int hour)
Sets the hour, recalculating the localTimeOfEpoch.
|
void |
setLocalTime(long time)
Sets the time in milliseconds since the epoch and calculate
the internal variables.
|
void |
setMillisecond(long millisecond)
Sets the millisecond, recalculating the localTimeOfEpoch.
|
void |
setMinute(int minute)
Sets the minute, recalculating the localTimeOfEpoch.
|
void |
setMonth(int month)
Sets the month in the year.
|
void |
setSecond(int second)
Sets the second, recalculating the localTimeOfEpoch.
|
long |
setTime(long hour,
long minute,
long second,
long ms) |
void |
setYear(int year)
Sets the year, recalculating the time since epoch.
|
java.lang.String |
toString() |
public static final int YEAR
public static final int MONTH
public static final int DAY_OF_MONTH
public static final int DAY
public static final int DAY_OF_WEEK
public static final int HOUR
public static final int MINUTE
public static final int SECOND
public static final int MILLISECOND
public static final int TIME
public static final int TIME_ZONE
public QDate()
public QDate(long time)
public QDate(boolean isLocal)
public QDate(java.util.TimeZone zone)
public QDate(java.util.TimeZone zone, long now)
public QDate(long year, long month, long dayOfMonth)
setDate(long, long, long)
public static QDate createLocal()
public static QDate allocateLocalDate()
public static void freeLocalDate(QDate date)
public static QDate allocateGmtDate()
public static void freeGmtDate(QDate date)
public void setLocalTime(long time)
public long getLocalTime()
public java.util.Calendar getCalendar()
public void setGMTTime(long time)
public long getGMTTime()
public long getTimeOfDay()
public int getYear()
public void setYear(int year)
public int getMonth()
public void setMonth(int month)
public int getDayOfMonth()
public void setDayOfMonth(int day)
public int getDaysInMonth()
public int getDayOfWeek()
public int getDayOfYear()
public int getHour()
public void setHour(int hour)
public int getMinute()
public void setMinute(int minute)
public int getSecond()
public void setSecond(int second)
public long getMillisecond()
public void setMillisecond(long millisecond)
public long getZoneOffset()
public java.lang.String getZoneName()
public boolean isDST()
public java.util.TimeZone getLocalTimeZone()
public int getWeek()
public long get(int field)
public long set(int field, long value)
public java.lang.String printDate()
public void printDate(CharBuffer cb)
public void printDate(WriteStream os) throws java.io.IOException
java.io.IOException
public void printRFC2822(CharBuffer cb)
public java.lang.String printISO8601()
public java.lang.String printISO8601Date()
public static java.lang.String formatGMT(long gmtTime, java.lang.String format)
time
- the time to formatformat
- the format stringpublic static java.lang.String formatGMT(long gmtTime)
time
- the time to formatpublic static java.lang.String formatLocal(long gmtTime, java.lang.String format)
time
- in milliseconds, GMT, from the epoch.format
- formatting string.public static java.lang.String formatLocal(long gmtTime)
time
- in milliseconds, GMT, from the epoch.public static CharBuffer formatLocal(CharBuffer cb, long gmtTime, java.lang.String format)
time
- in milliseconds, GMT, from the epoch.format
- formatting string.public static java.lang.String formatISO8601(long gmtTime)
public static QDate getGlobalDate()
public java.lang.String format(java.lang.String format)
public CharBuffer format(CharBuffer cb, java.lang.String format)
%a | day of week (short) |
%A | day of week (verbose) |
%b | month name (short) |
%B | month name (verbose) |
%c | Java locale date |
%d | day of month (two-digit) |
%F | %Y-%m-%d |
%H | 24-hour (two-digit) |
%I | 12-hour (two-digit) |
%j | day of year (three-digit) |
%l | 12-hour (one-digit prefixed by space) |
%m | month (two-digit) |
%M | minutes |
%p | am/pm |
%P | AM/PM |
%S | seconds |
%s | milliseconds |
%x | Java locale short date |
%X | Java locale short time |
%W | week in year (three-digit) |
%w | day of week (one-digit) |
%y | year (two-digit) |
%Y | year (four-digit) |
%Z | time zone (name) |
%z | time zone (+/-0800) |
public java.lang.String printLocaleDate()
public java.lang.String printShortLocaleDate()
public java.lang.String printShortLocaleTime()
public long parseLocalDate(java.lang.String string) throws java.lang.Exception
java.lang.Exception
public long parseDate(java.lang.String string) throws java.lang.Exception
java.lang.Exception
public long setDate(long year, long month, long day)
year
- month
- where January = 0day
- day of month where the 1st = 1public long setTime(long hour, long minute, long second, long ms)
public boolean isLeapYear()
public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object