public final class Dates
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DATE_APRIL |
static int |
DATE_AUGUST |
static int |
DATE_DAY |
static int |
DATE_DECEMBER |
static int |
DATE_FEBRUARY |
static int |
DATE_FRIDAY |
static int |
DATE_HOUR |
static int |
DATE_JANUARY
Months.
|
static int |
DATE_JULY |
static int |
DATE_JUNE |
static int |
DATE_MARCH |
static int |
DATE_MAY |
static int |
DATE_MINUTE |
static int |
DATE_MONDAY
Days of the week.
|
static int |
DATE_MONTH |
static int |
DATE_NOVEMBER |
static int |
DATE_OCTOBER |
static int |
DATE_SATURDAY |
static int |
DATE_SECOND |
static int |
DATE_SEPTEMBER |
static int |
DATE_SUNDAY |
static int |
DATE_THURSDAY |
static int |
DATE_TUESDAY |
static int |
DATE_WEDNESDAY |
static int |
DATE_WEEK |
static int |
DATE_YEAR
Date/time interval kinds.
|
Modifier and Type | Method and Description |
---|---|
static void |
DateAdd(java.util.Calendar date,
int intervalKind,
int interval)
Adds a time interval to the given date.
|
static java.util.Calendar |
DateValue(java.lang.String value)
Creates a date from the given string.
|
static int |
Day(java.util.Calendar date)
Returns the day of the month for the given date.
|
static java.lang.String |
FormatDate(java.util.Calendar date)
Converts and formats the given date into a date string.
|
static java.lang.String |
FormatDateTime(java.util.Calendar date)
Converts and formats the given date into a date and time string.
|
static java.lang.String |
FormatTime(java.util.Calendar date)
Converts and formats the given date into a time string.
|
static int |
Hour(java.util.Calendar date)
Returns the hours for the given date.
|
static int |
Minute(java.util.Calendar date)
Returns the minutes for the given date.
|
static int |
Month(java.util.Calendar date)
Returns the month of the given date.
|
static java.lang.String |
MonthName(java.util.Calendar date)
Returns the name of the month for the given date.
|
static java.util.Calendar |
Now()
Returns the current date and time.
|
static int |
Second(java.util.Calendar date)
Returns the seconds for the given date.
|
static long |
Timer()
Returns the current system time in milliseconds.
|
static int |
Weekday(java.util.Calendar date)
Returns the weekday for the given date.
|
static java.lang.String |
WeekdayName(java.util.Calendar date)
Returns the name of the weekday for the given date.
|
static int |
Year(java.util.Calendar date)
Returns the year of the given date.
|
public static final int DATE_YEAR
public static final int DATE_MONTH
public static final int DATE_DAY
public static final int DATE_WEEK
public static final int DATE_HOUR
public static final int DATE_MINUTE
public static final int DATE_SECOND
public static final int DATE_MONDAY
public static final int DATE_TUESDAY
public static final int DATE_WEDNESDAY
public static final int DATE_THURSDAY
public static final int DATE_FRIDAY
public static final int DATE_SATURDAY
public static final int DATE_SUNDAY
public static final int DATE_JANUARY
public static final int DATE_FEBRUARY
public static final int DATE_MARCH
public static final int DATE_APRIL
public static final int DATE_MAY
public static final int DATE_JUNE
public static final int DATE_JULY
public static final int DATE_AUGUST
public static final int DATE_SEPTEMBER
public static final int DATE_OCTOBER
public static final int DATE_NOVEMBER
public static final int DATE_DECEMBER
public static void DateAdd(java.util.Calendar date, int intervalKind, int interval)
date
- date to add tointervalKind
- kind of intervalinterval
- units to addpublic static java.util.Calendar DateValue(java.lang.String value)
Dates must be formatted as follows:
MM/DD/YYYY hh:mm:ss
or
MM/DD/YYYY
or
hh:mm
where MM is the month (01-12), DD the day (01-31), YYYY the year
(0000-9999), hh the hours (00-23), mm the minutes (00-59) and ss
the seconds (00-59).
value
- string to convertpublic static int Day(java.util.Calendar date)
date
- date to get day ofpublic static java.lang.String FormatDateTime(java.util.Calendar date)
date
- date to formatSimpleDateFormat
public static java.lang.String FormatDate(java.util.Calendar date)
date
- date to formatSimpleDateFormat
public static java.lang.String FormatTime(java.util.Calendar date)
date
- date to formatSimpleDateFormat
public static int Hour(java.util.Calendar date)
date
- date to use hours ofpublic static int Minute(java.util.Calendar date)
date
- date to use minutes ofpublic static int Month(java.util.Calendar date)
date
- date to use month ofDATE_JANUARY
, DATE_FEBRUARY
,
DATE_MARCH
, DATE_APRIL
,
DATE_MAY
, DATE_JUNE
,
DATE_JULY
, DATE_AUGUST
,
DATE_SEPTEMBER
, DATE_OCTOBER
,
DATE_NOVEMBER
, DATE_DECEMBER
public static java.lang.String MonthName(java.util.Calendar date)
date
- date to use month ofpublic static java.util.Calendar Now()
public static int Second(java.util.Calendar date)
date
- date to use seconds ofpublic static long Timer()
public static int Weekday(java.util.Calendar date)
date
- date to use weekday ofDATE_SUNDAY
, DATE_MONDAY
,
DATE_TUESDAY
, DATE_WEDNESDAY
,
DATE_THURSDAY
, DATE_FRIDAY
,
DATE_SATURDAY
public static java.lang.String WeekdayName(java.util.Calendar date)
date
- date to use weekday ofpublic static int Year(java.util.Calendar date)
date
- date to use year of