|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opengts.util.DateTime
public class DateTime
Performs every manner of function imaginable based on date/time values
Nested Class Summary | |
---|---|
static class |
DateTime.DateParseException
DateParseException class |
static class |
DateTime.DateStringFormat
Enum to indicate a date string format and to convert from one format to another |
static class |
DateTime.DefaultParsedTime
Enum indicating how to handle parsed dates when no time is specified CurrentTime - Use current time ContextStart - Use start of time context (ie. |
static class |
DateTime.ParsedDateTime
Class/Structure which holds date/time information |
static interface |
DateTime.TimeZoneProvider
TimeZoneProvider interface |
Field Summary | |
---|---|
static int |
APR
|
static int |
APRIL
|
static int |
AUG
|
static int |
AUGUST
|
static long |
DAYS_PER_WEEK
|
static int |
DEC
|
static int |
DECEMBER
|
static java.lang.String |
DEFAULT_DATE_FORMAT
|
static java.lang.String |
DEFAULT_DATETIME_FORMAT
|
static java.lang.String |
DEFAULT_DATETIME_TZ_FORMAT
|
static java.lang.String |
DEFAULT_TIME_FORMAT
|
static java.lang.String |
DEFAULT_TIMEZONE_FORMAT
|
static int |
FEB
|
static int |
FEBRUARY
|
static int |
FRI
|
static int |
FRIDAY
|
static java.util.TimeZone |
GMT
|
static java.lang.String |
GMT_TIMEZONE
|
static long |
HOURS_PER_DAY
|
static double |
HOURS_PER_MINUTE
|
static double |
HOURS_PER_SECOND
|
static DateTime |
INVALID_DATETIME
|
static java.lang.String |
ISO8601_DATETIME_FORMAT
|
static int |
JAN
|
static int |
JANUARY
|
static int |
JUL
|
static int |
JULY
|
static int |
JUN
|
static int |
JUNE
|
static boolean |
LOWERCASE_TIMEZONE_LOOKUP
|
static int |
MAR
|
static int |
MARCH
|
static DateTime |
MAX_DATETIME
|
static long |
MAX_TIMESEC
|
static int |
MAY
|
static DateTime |
MIN_DATETIME
|
static long |
MIN_TIMESEC
|
static long |
MINUTES_PER_DAY
|
static long |
MINUTES_PER_HOUR
|
static double |
MINUTES_PER_SECOND
|
static long |
MINUTES_PER_WEEK
|
static int |
MON
|
static int |
MONDAY
|
static int |
MONTHS_PER_YEAR
|
static int |
NOV
|
static int |
NOVEMBER
|
static int |
OCT
|
static int |
OCTOBER
|
static int |
SAT
|
static int |
SATURDAY
|
static long |
SECONDS_PER_DAY
|
static long |
SECONDS_PER_HOUR
|
static long |
SECONDS_PER_MINUTE
|
static long |
SECONDS_PER_WEEK
|
static int |
SEP
|
static int |
SEPTEMBER
|
static int |
SUN
|
static int |
SUNDAY
|
static int |
THU
|
static int |
THURSDAY
|
static int |
TUE
|
static int |
TUESDAY
|
static int |
WED
|
static int |
WEDNESDAY
|
Constructor Summary | |
---|---|
DateTime()
Default constructor. |
|
DateTime(java.util.Date date)
Constructor. |
|
DateTime(DateTime dt)
Copy constructor |
|
DateTime(DateTime dt,
long deltaOffsetSec)
Copy constructor with delta offset time |
|
DateTime(java.util.Date date,
java.util.TimeZone tz)
Constructor. |
|
DateTime(long timeSec)
Constructor. |
|
DateTime(long timeSec,
java.util.TimeZone tz)
Constructor. |
|
DateTime(java.lang.String d)
Constructor. |
|
DateTime(java.util.TimeZone tz)
Constructor. |
|
DateTime(java.util.TimeZone tz,
int year,
int month1,
int day)
Constructor (time is set to Noon) |
|
DateTime(java.util.TimeZone tz,
int year,
int month1,
int day,
int hour24,
int minute,
int second)
Constructor. |
Method Summary | |
---|---|
protected java.util.TimeZone |
_timeZone(java.util.TimeZone tz)
Returns a non-null TimeZone |
java.lang.Object |
clone()
Returns a clone of this DateTime instance |
static java.lang.String |
CompactDateTimeFormat(char sep)
Returns a compact date/time format This format can be parsed by the "parseArgumentDate" method if the specified separator is one of ",", " ", or "|". |
static java.lang.String |
CompactDateTimeFormat(java.lang.String sep)
Returns a compact date/time format This format can be parsed by the "parseArgumentDate" method if the specified separator is one of ",", " ", or "|". |
int |
compareTo(java.lang.Object other)
Compares another DateTime instance to this instance. |
static long |
DaySeconds(double days)
Returns the number of seconds in the specified number of days |
static long |
DaySeconds(long days)
Returns the number of seconds in the specified number of days |
static java.lang.String |
encodeHourMinuteSecond(long tod,
java.lang.String fmt)
Formats the time-of-day, based on the specified format. |
boolean |
equals(java.lang.Object obj)
Returns true if the specified DateTime is equal-to this DateTime instance |
static java.lang.String |
format(java.util.Date date,
java.util.TimeZone tz,
java.lang.String dtFmt)
Formats the specified Date instance. |
java.lang.String |
format(java.lang.String fmt)
Formats the current DateTime instance. |
java.lang.String |
format(java.lang.String fmt,
java.util.TimeZone tz)
Formats the current DateTime instance. |
java.lang.String |
format(java.lang.String dtFmt,
java.util.TimeZone tz,
java.lang.StringBuffer sb)
Formats the current DateTime instance. |
java.lang.String |
format(java.util.TimeZone tz)
Formats the current DateTime instance (using format "MMM dd, yyyy HH:mm:ss z") |
java.util.Calendar |
getCalendar()
Gets a GregorianCalendar calendar instance |
java.util.Calendar |
getCalendar(java.util.TimeZone tz)
Gets a GregorianCalendar calendar instance |
static long |
getCurrentDayNumber(java.util.TimeZone tz)
Returns the current (today) day number |
static long |
getCurrentTimeMillis()
Returns the current Epoch time in milliseconds since January 1, 1970 00:00:00 GMT |
static long |
getCurrentTimeSec()
Returns the current Epoch time in seconds since January 1, 1970 00:00:00 GMT |
java.util.Date |
getDate()
Gets a Date object based on the time in this DateTime object |
static DateTime.ParsedDateTime |
getDateFromDayNumber(long dayNumber)
Returns the year/month/day from the day number (days since October 15, 1582) |
static DateTime.ParsedDateTime |
getDateFromDayNumber(long dayNumber,
java.util.TimeZone tmz)
Returns the year/month/day from the day number (days since October 15, 1582) |
static char[] |
GetDateSeparatorChars(java.lang.String dateFormat)
Analyzes the specified date format to determine the date separator characters |
static DateTime.DateStringFormat |
getDateStringFormat(java.lang.String dsfStr)
Returns the defined DateStringFormat for the specified account. |
long |
getDayEnd()
Returns an Epoch time in seconds which is the end of the day represented by this instance. |
long |
getDayEnd(java.util.TimeZone tz)
Returns an Epoch time in seconds which is the end of the day represented by this instance. |
long |
getDayEndGMT()
Returns the Epoch timestamp representing the end of the current day represented by this DateTime instance, based on the GMT TimeZone. |
static int |
getDayIndex(java.lang.String day,
int dft)
Gets the day-of-week number for the specified day short abbreviation |
static java.lang.String |
getDayName(int day,
boolean abbrev)
Gets the day-of-week name for the specified day number/index |
static java.lang.String |
getDayName(int day,
int abbrev)
Gets the day-of-week name for the specified day number/index |
static java.util.Map<java.lang.String,java.lang.Integer> |
getDayNameMap(boolean abbrev)
Returns a Map object of day-of-week names to their 0-based number/index (used as a VComboBox item list) |
static java.util.Map<java.lang.String,java.lang.Integer> |
getDayNameMap(int abbrev)
Returns a Map object of day-of-week names to their 0-based number/index (used as a VComboBox item list) |
static java.lang.String[] |
getDayNames(boolean abbrev)
Returns an array of day-of-week names |
static java.lang.String[] |
getDayNames(int abbrev)
Returns an array of day-of-week names |
long |
getDayNumber()
Returns the DayNumber long, for this DateTime instance |
long |
getDayNumber(java.util.TimeZone tz)
Returns the DayNumber long, for this DateTime instance |
static long |
getDayNumberFromDate(DateTime.ParsedDateTime pdt)
Returns the day number of days since October 15, 1582 (the first day of the Gregorian Calendar) |
static long |
getDayNumberFromDate(DateTime dt)
Returns the day number of days since October 15, 1582 (the first day of the Gregorian Calendar) |
static long |
getDayNumberFromDate(DateTime dt,
java.util.TimeZone tz)
Returns the day number of days since October 15, 1582 (the first day of the Gregorian Calendar) |
static long |
getDayNumberFromDate(int year,
int month1,
int day)
Returns the day number of days since October 15, 1582 (the first day of the Gregorian Calendar) |
int |
getDayOfMonth()
Gets the day of the month represented by this DateTime instance |
int |
getDayOfMonth(java.util.TimeZone tz)
Gets the day of the month represented by this DateTime instance |
int |
getDayOfWeek()
Returns the day of week for this DateTime instance |
static int |
getDayOfWeek(int year,
int mon1,
int day)
Returns the day of the week for the specified year/month/day |
int |
getDayOfWeek(java.util.TimeZone tz)
Returns the day of week for this DateTime instance |
static int |
getDayOfYear(int year,
int mon1,
int day)
Returns the day of the year for the specified year/month/day |
int |
getDaysInMonth()
Gets the number of days in the month represented by this DateTime instance |
int |
getDaysInMonth(java.util.TimeZone tz)
Gets the number of days in the month represented by this DateTime instance |
static int |
getDaysInMonth(java.util.TimeZone tz,
int mon1,
int year)
Gets the number of days in the specified month |
long |
getDayStart()
Returns an Epoch time in seconds which is the beginning of the day represented by this instance. |
long |
getDayStart(java.util.TimeZone tz)
Returns an Epoch time in seconds which is the beginning of the day represented by this instance. |
long |
getDayStartGMT()
Returns the Epoch timestamp representing the start of the current day represented by this DateTime instance, based on the GMT TimeZone. |
static java.util.TimeZone |
getDefaultTimeZone()
Returns the default TimeZone |
static java.util.TimeZone |
getGMTTimeZone()
Returns the GMT TimeZone |
int |
getHour12()
Returns the hour of the day (12-hour clock) |
int |
getHour12(java.util.TimeZone tz)
Returns the hour of the day (12-hour clock) |
int |
getHour24()
Returns the hour of the day (24-hour clock) |
int |
getHour24(java.util.TimeZone tz)
Returns the hour of the day (24-hour clock) |
static java.lang.String[] |
getHours(boolean hr24)
Gets a String array of hours in a day (used as a VComboBox item list) |
static DateTime |
getMaxDate()
Gets the maximum acceptable DateTime |
static DateTime |
getMaxDate(java.util.TimeZone tz)
Gets the maximum acceptable DateTime |
static int |
getMaxMonthDayCount(int mon1,
boolean isLeapYear)
Gets the maximum number of days in the specified month |
static DateTime |
getMinDate()
Gets the minimum acceptable DateTime |
static DateTime |
getMinDate(java.util.TimeZone tz)
Gets the minimum acceptable DateTime |
int |
getMinute()
Returns the minute of the hour |
int |
getMinute(java.util.TimeZone tz)
Returns the minute of the hour |
int |
getMinuteOfDay()
Returns the minute of the current day |
int |
getMinuteOfDay(java.util.TimeZone tz)
Returns the minute of the current day |
static java.lang.String[] |
getMinutes()
Gets a String array of minutes in a day (used as a VComboBox item list) |
int |
getMonth0()
Gets the 0-based index of the month represented by this DateTime instance |
int |
getMonth0(java.util.TimeZone tz)
Gets the 0-based index of the month represented by this DateTime instance |
int |
getMonth1()
Gets the 1-based index of the month represented by this DateTime instance |
int |
getMonth1(java.util.TimeZone tz)
Gets the 1-based index of the month represented by this DateTime instance |
long |
getMonthDelta(java.util.TimeZone tz,
int deltaMo)
Returns the Epoch timestamp representing the current date, plus the number of months offset. |
long |
getMonthEnd()
Returns the Epoch timestamp representing the end of the month represented by this DateTime instance. |
long |
getMonthEnd(int deltaMo)
Returns the Epoch timestamp representing the end of the month represented by this DateTime instance, plus the specified delta month offset. |
long |
getMonthEnd(java.util.TimeZone tz)
Returns the Epoch timestamp representing the end of the month represented by this DateTime instance. |
long |
getMonthEnd(java.util.TimeZone tz,
int deltaMo)
Returns the Epoch timestamp representing the end of the month represented by this DateTime instance, plus the specified delta month offset. |
static int |
getMonthIndex0(java.lang.String month,
int dft)
Gets the 0-based index for the specified month abbreviation |
static int |
getMonthIndex1(java.lang.String month,
int dft)
Gets the 1-based index for the specified month abbreviation |
static java.lang.String |
getMonthName(int mon1,
boolean abbrev)
Gets the month name/abbreviation for the specified 1-based month index |
static java.util.Map<java.lang.String,java.lang.Integer> |
getMonthNameMap(boolean abbrev)
Returns a Map object containing a map of month names/abbreviations and it's 0-based month index [0..11] |
static java.lang.String[] |
getMonthNames(boolean abbrev)
Returns all month names/appreviations |
long |
getMonthStart()
Returns the Epoch timestamp representing the beginning of the month represented by this DateTime instance. |
long |
getMonthStart(int deltaMo)
Returns the Epoch timestamp representing the beginning of the month represented by this DateTime instance, plus the specified delta month offset. |
long |
getMonthStart(java.util.TimeZone tz)
Returns the Epoch timestamp representing the beginning of the month represented by this DateTime instance. |
long |
getMonthStart(java.util.TimeZone tz,
int deltaMo)
Returns the Epoch timestamp representing the beginning of the month represented by this DateTime instance, plus the specified delta month offset. |
int |
getSecond()
Returns the second of the minute |
int |
getSecond(java.util.TimeZone tz)
Returns the second of the minute |
int |
getSecondOfDay()
Returns the second of the current day |
int |
getSecondOfDay(java.util.TimeZone tz)
Returns the second of the current day (Time of day) |
long |
getTimeMillis()
Gets the Epoch time in milliseconds represented by this instance |
long |
getTimeSec()
Gets the Epoch time in seconds represented by this instance |
java.util.TimeZone |
getTimeZone()
Returns the default (or current) TimeZone |
static java.util.TimeZone |
getTimeZone(java.lang.String tzid)
Gets the TimeZone instance for the specified TimeZone id |
static java.util.TimeZone |
getTimeZone(java.lang.String tzid,
java.util.TimeZone dft)
Gets the TimeZone instance for the specified TimeZone id |
java.lang.String |
getTimeZoneID()
Returns the ID of the current TimeZone |
java.lang.String |
getTimeZoneShortName()
Returns the short-name of the current TimeZone |
int |
getYear()
Returns the year for this DataTime instance |
int |
getYear(java.util.TimeZone tz)
Returns the year for this DataTime instance |
double |
getYearsSince(DateTime priorDate)
Return the number of years since specified date (year/month/day). |
double |
getYearsSince(DateTime priorDate,
java.util.TimeZone tz)
Return the number of years since specified date (year/month/day). |
double |
getYearsSince(int year,
int month1,
int day)
Return the number of years since specified date (year/month/day). |
double |
getYearsSince(long priorDayNumber)
Return the number of years since specified date (year/month/day). |
double |
getYearsSince(long priorDayNumber,
java.util.TimeZone tz)
Return the number of years since specified date (year/month/day). |
java.lang.String |
gmtFormat()
Formats the current DateTime instance (using format "yyyy/MM/dd HH:mm:ss 'GMT'"), based on the GMT TimeZone. |
java.lang.String |
gmtFormat(java.lang.String fmt)
Formats the current DateTime instance, based on the GMT TimeZone. |
java.lang.String |
gmtFormat(java.lang.String fmt,
java.lang.StringBuffer sb)
Formats the current DateTime instance, based on the GMT TimeZone. |
static long |
HourSeconds(long hours)
Returns the number of seconds in the specified number of hours |
boolean |
isAfter(DateTime dt)
Returns true if the this DateTime is after the specified DateTime instance |
boolean |
isAfter(DateTime dt,
boolean inclusive)
Returns true if the this DateTime is after the specified DateTime instance |
boolean |
isAM()
Returns true if AM, false if PM |
boolean |
isAM(java.util.TimeZone tz)
Returns true if AM, false if PM |
boolean |
isBefore(DateTime dt)
Returns true if this DateTime is before the specified DateTime instance |
boolean |
isBefore(DateTime dt,
boolean inclusive)
Returns true if this DateTime is before the specified DateTime instance |
boolean |
isDaylightSavings()
Returns true if this DateTime instance currently represents a daylight savings time. |
boolean |
isDaylightSavings(java.util.TimeZone tz)
Returns true if this DateTime instance currently represents a daylight savings time. |
boolean |
isFuture(long deltaSec)
Returns true if the this DateTime is more than the specified seconds into the future. |
boolean |
isLeapYear()
Returns true if this DateTime instance represents a leap-year |
static boolean |
isLeapYear(int year)
Returns true if the specified year represents a leap-year |
boolean |
isLeapYear(java.util.TimeZone tz)
Returns true if this DateTime instance represents a leap-year |
boolean |
isPM()
Returns true if PM, false if AM |
boolean |
isPM(java.util.TimeZone tz)
Returns true if PM, false if AM |
static boolean |
isRecentSec(long timeSec,
long lapseSec)
Returns true if the specified time is within the specified lapsed time |
static boolean |
isValid(DateTime dt)
Returns true if the specified date is valid |
static boolean |
isValidTimeZone(java.lang.String tzid)
Returns true if the specified TimeZone is valid |
static void |
main(java.lang.String[] argv)
Main entry point for testing/debugging |
static long |
MinuteSeconds(long minutes)
Returns the number of seconds in the specified number of minutes |
static DateTime |
parseArgumentDate(java.lang.String dateStr)
Parse specified String into a DateTime instance. |
static DateTime |
parseArgumentDate(java.lang.String dateStr,
java.util.TimeZone dftTZ)
Parse specified String into a DateTime instance. |
static DateTime |
parseArgumentDate(java.lang.String dateStr,
java.util.TimeZone dftTZ,
boolean isToDate)
Parse specified String into a DateTime instance. |
static DateTime |
parseArgumentDate(java.lang.String dateStr,
java.util.TimeZone dftTZ,
DateTime.DefaultParsedTime dftTime)
Parse specified String into a DateTime instance. |
static DateTime.ParsedDateTime |
parseDateTime(java.lang.String dateStr,
java.util.TimeZone dftTZ,
DateTime.DefaultParsedTime dftTime)
Parse specified String into a ParsedDateTime instance. |
static int |
parseHourMinuteSecond(java.lang.String hms)
Parses the specified "hhhh:mm:ss" String into the number of represented seconds |
static int |
parseHourMinuteSecond(java.lang.String hms,
int dft)
Parses the specified "hhhh:mm:ss" String into the number of represented seconds |
static java.lang.String[] |
readTimeZones(java.io.File tmzFile)
Reads the available TimeZone IDs from the specified file. |
void |
setDate(java.lang.String d)
Sets the current time of this instance |
void |
setDate(java.lang.String d,
java.util.TimeZone dftTMZ)
Sets the current time of this instance |
void |
setDate(java.util.TimeZone tz,
int year,
int month1,
int day)
Sets the current date of this instance (time is left unchanged) |
void |
setDate(java.util.TimeZone tz,
int year,
int month1,
int day,
int hour24,
int minute,
int second)
Sets the current time of this instance |
void |
setTimeMillis(long timeMillis)
Sets the Epoch time in milliseconds represented by this instance |
void |
setTimeSec(long timeSec)
Sets the Epoch time in seconds represented by this instance |
void |
setTimeZone(java.lang.String tz)
Sets the current TimeZone |
void |
setTimeZone(java.util.TimeZone tz)
Sets the current TimeZone |
java.lang.String |
shortFormat(java.util.TimeZone tz)
Formats the current DateTime instance (using format "MMM dd, yyyy HH:mm:ss z") |
java.lang.String |
toString()
Returns a String representation of this DateTime instance |
static java.lang.String |
toString(long timeSec)
Returns a String representation of the specified epoch time seconds |
java.lang.String |
toString(java.util.TimeZone tmz)
Returns a String representation of this DateTime instance |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String GMT_TIMEZONE
public static final java.util.TimeZone GMT
public static final boolean LOWERCASE_TIMEZONE_LOOKUP
public static final java.lang.String DEFAULT_DATE_FORMAT
public static final java.lang.String DEFAULT_TIME_FORMAT
public static final java.lang.String DEFAULT_TIMEZONE_FORMAT
public static final java.lang.String ISO8601_DATETIME_FORMAT
public static final java.lang.String DEFAULT_DATETIME_FORMAT
public static final java.lang.String DEFAULT_DATETIME_TZ_FORMAT
public static final DateTime INVALID_DATETIME
public static final DateTime MIN_DATETIME
public static final DateTime MAX_DATETIME
public static final long MIN_TIMESEC
public static final long MAX_TIMESEC
public static final long HOURS_PER_DAY
public static final long SECONDS_PER_MINUTE
public static final long MINUTES_PER_HOUR
public static final long DAYS_PER_WEEK
public static final long SECONDS_PER_HOUR
public static final long MINUTES_PER_DAY
public static final long SECONDS_PER_DAY
public static final long MINUTES_PER_WEEK
public static final long SECONDS_PER_WEEK
public static final double MINUTES_PER_SECOND
public static final double HOURS_PER_MINUTE
public static final double HOURS_PER_SECOND
public static final int MONTHS_PER_YEAR
public static final int JAN
public static final int FEB
public static final int MAR
public static final int APR
public static final int MAY
public static final int JUN
public static final int JUL
public static final int AUG
public static final int SEP
public static final int OCT
public static final int NOV
public static final int DEC
public static final int JANUARY
public static final int FEBRUARY
public static final int MARCH
public static final int APRIL
public static final int JUNE
public static final int JULY
public static final int AUGUST
public static final int SEPTEMBER
public static final int OCTOBER
public static final int NOVEMBER
public static final int DECEMBER
public static final int SUN
public static final int MON
public static final int TUE
public static final int WED
public static final int THU
public static final int FRI
public static final int SAT
public static final int SUNDAY
public static final int MONDAY
public static final int TUESDAY
public static final int WEDNESDAY
public static final int THURSDAY
public static final int FRIDAY
public static final int SATURDAY
Constructor Detail |
---|
public DateTime()
public DateTime(java.util.TimeZone tz)
tz
- The TimeZonepublic DateTime(java.util.Date date)
date
- The Date object used to initialize this DateTimepublic DateTime(java.util.Date date, java.util.TimeZone tz)
date
- The Date object used to initialize this DateTimetz
- The TimeZonepublic DateTime(java.util.TimeZone tz, int year, int month1, int day)
tz
- The TimeZoneyear
- The yearmonth1
- The 1-based month index [1..12]day
- The daypublic DateTime(java.util.TimeZone tz, int year, int month1, int day, int hour24, int minute, int second)
tz
- The TimeZoneyear
- The yearmonth1
- The 1-based month index [1..12]day
- The dayhour24
- The hour of the day [24 hour clock]minute
- The minute of the hoursecond
- The second of the minutepublic DateTime(long timeSec)
timeSec
- The Epoch time in secondspublic DateTime(long timeSec, java.util.TimeZone tz)
timeSec
- The Epoch time in secondstz
- The TimeZonepublic DateTime(java.lang.String d) throws DateTime.DateParseException
d
- A date/time String representation
DateTime.DateParseException
- if an invalid date/time format was specified.public DateTime(DateTime dt)
dt
- Another DateTime instancepublic DateTime(DateTime dt, long deltaOffsetSec)
dt
- Another DateTime instancedeltaOffsetSec
- +/- offset from time specified in DateTime instanceMethod Detail |
---|
public static java.lang.String CompactDateTimeFormat(java.lang.String sep)
sep
- The date|time|zone separator String.
public static java.lang.String CompactDateTimeFormat(char sep)
sep
- The date|time|zone separator character.
public static char[] GetDateSeparatorChars(java.lang.String dateFormat)
dateFormat
- The date format to analyze
public static DateTime.DateStringFormat getDateStringFormat(java.lang.String dsfStr)
dsfStr
- The String value of the format (ie. "YMD", "MDY", "DMY")
public static long DaySeconds(long days)
days
- The number of days to convert to seconds
public static long DaySeconds(double days)
days
- The number of days to convert to seconds
public static long HourSeconds(long hours)
hours
- The number of hours to convert to seconds
public static long MinuteSeconds(long minutes)
minutes
- The number of minutes to convert to seconds
public static int getMonthIndex0(java.lang.String month, int dft)
month
- The month abbreviation
public static int getMonthIndex1(java.lang.String month, int dft)
month
- The month abbreviation
public static java.lang.String getMonthName(int mon1, boolean abbrev)
mon1
- A 1-based month index [1..12]abbrev
- True to return the month abbreviation, false to return the name
public static java.lang.String[] getMonthNames(boolean abbrev)
abbrev
- True to return month abbreviations, false to return month names
public static java.util.Map<java.lang.String,java.lang.Integer> getMonthNameMap(boolean abbrev)
abbrev
- True to create the Map object with abbreviations, false for names
public static int getDaysInMonth(java.util.TimeZone tz, int mon1, int year)
tz
- The TimeZonemon1
- The 1-based month index [1..12]year
- The year [valid for all AD years]
public static int getMaxMonthDayCount(int mon1, boolean isLeapYear)
mon1
- The 1-based month index [1..12]isLeapYear
- True for leap-year, false otherwise
public static boolean isLeapYear(int year)
year
- The year [valid for all AD years]
public static int getDayIndex(java.lang.String day, int dft)
day
- The day short abbreviation
public static java.lang.String getDayName(int day, int abbrev)
day
- A 0-based day number/index [0..6]abbrev
- 0 for full name, 1 for abbreviation, 2 for short abbreviation
public static java.lang.String getDayName(int day, boolean abbrev)
day
- A 0-based day number/index [0..6]abbrev
- True for abbreviation, false for full name
public static java.lang.String[] getDayNames(int abbrev)
abbrev
- 0 for full name, 1 for abbreviation, 2 for short abbreviation
public static java.lang.String[] getDayNames(boolean abbrev)
abbrev
- True abbreviations, false for full names
public static java.util.Map<java.lang.String,java.lang.Integer> getDayNameMap(int abbrev)
abbrev
- 0 for full name, 1 for abbreviation, 2 for short abbreviation
public static java.util.Map<java.lang.String,java.lang.Integer> getDayNameMap(boolean abbrev)
abbrev
- True for abbreviations, false for full names
public static int getDayOfWeek(int year, int mon1, int day)
year
- The year [valid for dates after 1582/10/15]mon1
- The month [1..12]day
- The day [1..31]
public static int getDayOfYear(int year, int mon1, int day)
year
- The year [valid for dates after 1582/10/15]mon1
- The month [1..12]day
- The day [1..31]
public static java.lang.String[] getHours(boolean hr24)
hr24
- True for 24 hour clock, false for 12 hour clock
public static java.lang.String[] getMinutes()
public static java.lang.String toString(long timeSec)
timeSec
- The Epoch time seconds
public static long getCurrentTimeSec()
public static long getCurrentTimeMillis()
public static boolean isRecentSec(long timeSec, long lapseSec)
timeSec
- An Epoch time in secondslapseSec
- The time duration to test
public static boolean isValid(DateTime dt)
dt
- The DateTime to check
public static DateTime getMinDate()
public static DateTime getMinDate(java.util.TimeZone tz)
tz
- The TimeZone (not that it really matters)
public static DateTime getMaxDate()
public static DateTime getMaxDate(java.util.TimeZone tz)
tz
- The TimeZone (not that it really matters)
public static DateTime.ParsedDateTime parseDateTime(java.lang.String dateStr, java.util.TimeZone dftTZ, DateTime.DefaultParsedTime dftTime) throws DateTime.DateParseException
dateStr
- The date String to parsedftTZ
- The default TimeZonedftTime
- Enum indicating what 'time' to use if a time is not specified
DateTime.DateParseException
- if an invalid date/time format was specified.public static DateTime parseArgumentDate(java.lang.String dateStr, java.util.TimeZone dftTZ, DateTime.DefaultParsedTime dftTime) throws DateTime.DateParseException
dateStr
- The date String to parsedftTZ
- The default TimeZonedftTime
- Enum indicating what 'time' to use if a time is not specified
DateTime.DateParseException
- if an invalid date/time format was specified.public static DateTime parseArgumentDate(java.lang.String dateStr, java.util.TimeZone dftTZ, boolean isToDate) throws DateTime.DateParseException
dateStr
- The date String to parsedftTZ
- The default TimeZoneisToDate
- True to default to an end-of-day time if the time is not specified
DateTime.DateParseException
- if an invalid date/time format was specified.public static DateTime parseArgumentDate(java.lang.String dateStr, java.util.TimeZone dftTZ) throws DateTime.DateParseException
dateStr
- The date String to parsedftTZ
- The default TimeZone
DateTime.DateParseException
- if an invalid date/time format was specified.public static DateTime parseArgumentDate(java.lang.String dateStr) throws DateTime.DateParseException
dateStr
- The date String to parse
DateTime.DateParseException
- if an invalid date/time format was specified.public static long getDayNumberFromDate(int year, int month1, int day)
year
- The year [1582..4000]month1
- The month [1..12]day
- The day [1..31]
public static long getDayNumberFromDate(DateTime.ParsedDateTime pdt)
public static long getDayNumberFromDate(DateTime dt, java.util.TimeZone tz)
public static long getDayNumberFromDate(DateTime dt)
public static long getCurrentDayNumber(java.util.TimeZone tz)
tz
- The current timezone
public static DateTime.ParsedDateTime getDateFromDayNumber(long dayNumber)
dayNumber
- The number of days since October 15, 1582
public static DateTime.ParsedDateTime getDateFromDayNumber(long dayNumber, java.util.TimeZone tmz)
dayNumber
- The number of days since October 15, 1582
public java.util.Date getDate()
public void setDate(java.util.TimeZone tz, int year, int month1, int day)
tz
- The TimeZoneyear
- The yearmonth1
- The 1-based month index [1..12]day
- The daypublic void setDate(java.util.TimeZone tz, int year, int month1, int day, int hour24, int minute, int second)
tz
- The TimeZoneyear
- The year (1970+)month1
- The 1-based month index [1..12]day
- The day of the monthhour24
- The hour of the day [24 hour clock]minute
- The minute of the hoursecond
- The second of the minutepublic void setDate(java.lang.String d) throws DateTime.DateParseException
d
- The String representation of a date/time
DateTime.DateParseException
- if an invalid date/time format was specified.public void setDate(java.lang.String d, java.util.TimeZone dftTMZ) throws DateTime.DateParseException
d
- The String representation of a date/timedftTMZ
- The TimeZone used if no timezone was parsed from the String
DateTime.DateParseException
- if an invalid date/time format was specified.public java.util.Calendar getCalendar(java.util.TimeZone tz)
tz
- The TimeZone
public java.util.Calendar getCalendar()
public int getMonth0(java.util.TimeZone tz)
tz
- The TimeZone used when calculating the 0-based month index
public int getMonth0()
public int getMonth1(java.util.TimeZone tz)
tz
- The TimeZone used when calculating the 0-based month index
public int getMonth1()
public int getDayOfMonth(java.util.TimeZone tz)
tz
- The TimeZone used when calculating the day of the month
public int getDayOfMonth()
public int getDaysInMonth(java.util.TimeZone tz)
tz
- The TimeZone used when calculating the number of days in the month
public int getDaysInMonth()
public int getDayOfWeek(java.util.TimeZone tz)
tz
- The TimeZone used when calculating the day of week
public int getDayOfWeek()
public int getYear(java.util.TimeZone tz)
tz
- The TimeZone used when calculating the year
public int getYear()
public boolean isLeapYear(java.util.TimeZone tz)
tz
- The TimeZone used when calculating the leap-year
public boolean isLeapYear()
public int getHour24(java.util.TimeZone tz)
tz
- The TimeZone used when calculating the hour of the day
public int getHour24()
public int getHour12(java.util.TimeZone tz)
tz
- The TimeZone used when calculating the hour of the day
public int getHour12()
public boolean isAM(java.util.TimeZone tz)
tz
- The TimeZone used when calculating AM/PM
public boolean isAM()
public boolean isPM(java.util.TimeZone tz)
tz
- The TimeZone used when calculating AM/PM
public boolean isPM()
public int getMinute(java.util.TimeZone tz)
tz
- The TimeZone used when calculating the minute
public int getMinute()
public int getMinuteOfDay(java.util.TimeZone tz)
tz
- The TimeZone used when calculating the minute
public int getMinuteOfDay()
public int getSecond(java.util.TimeZone tz)
tz
- The TimeZone used when calculating the second
public int getSecond()
public int getSecondOfDay(java.util.TimeZone tz)
tz
- The TimeZone used when calculating the second
public int getSecondOfDay()
public boolean isDaylightSavings(java.util.TimeZone tz)
tz
- The TimeZone used when calculating daylight savings time.
public boolean isDaylightSavings()
public long getDayNumber(java.util.TimeZone tz)
tz
- the Timezone
public long getDayNumber()
public long getTimeSec()
public void setTimeSec(long timeSec)
timeSec
- Epoch time in secondspublic long getTimeMillis()
public void setTimeMillis(long timeMillis)
timeMillis
- Epoch time in millisecondspublic long getDayStart(java.util.TimeZone tz)
tz
- The TimeZone
public long getDayStart()
public long getDayEnd(java.util.TimeZone tz)
tz
- The TimeZone
public long getDayEnd()
public long getMonthStart(java.util.TimeZone tz, int deltaMo)
tz
- The overriding TimeZonedeltaMo
- The delta monnths (added to the month represented by this DateTime instance)
public long getMonthStart(java.util.TimeZone tz)
tz
- The overriding TimeZone
public long getMonthStart(int deltaMo)
deltaMo
- The delta monnths (added to the month represented by this DateTime instance)
public long getMonthStart()
public long getMonthEnd(java.util.TimeZone tz, int deltaMo)
tz
- The overriding TimeZonedeltaMo
- The delta monnths (added to the month represented by this DateTime instance)
public long getMonthEnd(java.util.TimeZone tz)
tz
- The overriding TimeZone
public long getMonthEnd(int deltaMo)
deltaMo
- The delta monnths (added to the month represented by this DateTime instance)
public long getMonthEnd()
public long getMonthDelta(java.util.TimeZone tz, int deltaMo)
tz
- The overriding TimeZonedeltaMo
- The delta monnths (added to the month represented by this DateTime instance)
public long getDayStartGMT()
public long getDayEndGMT()
public boolean isFuture(long deltaSec)
deltaSec
- The number of seconds into the future.
public boolean isAfter(DateTime dt)
dt
- the other DateTime instance
public boolean isAfter(DateTime dt, boolean inclusive)
dt
- the other DateTime instanceinclusive
- True to test for this "equal-to or after" the specified date,
false to test only for "after".
public boolean isBefore(DateTime dt)
dt
- the other DateTime instance
public boolean isBefore(DateTime dt, boolean inclusive)
dt
- the other DateTime instanceinclusive
- True to test for "equal-to or before", false to test only for "before".
public double getYearsSince(DateTime priorDate)
priorDate
- Prior date
public double getYearsSince(DateTime priorDate, java.util.TimeZone tz)
priorDate
- Prior date
public double getYearsSince(int year, int month1, int day)
year
- Prior yearmonth1
- Month of prior year (1..12)day
- Day of month
public double getYearsSince(long priorDayNumber)
priorDayNumber
- Prior day-number
public double getYearsSince(long priorDayNumber, java.util.TimeZone tz)
priorDayNumber
- Prior day-numbertz
- TimeZone
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the other DateTime instance
public int compareTo(java.lang.Object other)
compareTo
in interface java.lang.Comparable
other
- The other DateTime instance.
protected java.util.TimeZone _timeZone(java.util.TimeZone tz)
tz
- The TimeZone returned (if non-null)
public java.util.TimeZone getTimeZone()
public java.lang.String getTimeZoneID()
public java.lang.String getTimeZoneShortName()
public void setTimeZone(java.util.TimeZone tz)
tz
- The TimeZone to setpublic void setTimeZone(java.lang.String tz)
tz
- The TimeZone ID to setpublic static java.lang.String[] readTimeZones(java.io.File tmzFile)
tmzFile
- The file from which TimeZone IDs are read.
public static boolean isValidTimeZone(java.lang.String tzid)
tzid
- The String representation of a TimeZone
public static java.util.TimeZone getTimeZone(java.lang.String tzid, java.util.TimeZone dft)
tzid
- The TimeZone iddft
- The default TimeZone to return if the specified TimeZone id
does not exist.
public static java.util.TimeZone getTimeZone(java.lang.String tzid)
tzid
- The TimeZone id
public static java.util.TimeZone getDefaultTimeZone()
public static java.util.TimeZone getGMTTimeZone()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.util.TimeZone tmz)
public static java.lang.String format(java.util.Date date, java.util.TimeZone tz, java.lang.String dtFmt)
date
- The Date instancetz
- The TimeZonedtFmt
- The Date/Time format
public java.lang.String format(java.lang.String dtFmt, java.util.TimeZone tz, java.lang.StringBuffer sb)
dtFmt
- The Date/Time formattz
- The overriding TimeZonesb
- The StringBuffer where the formatted Date/Time is placed (may be null)
public java.lang.String format(java.lang.String fmt, java.util.TimeZone tz)
fmt
- The Date/Time formattz
- The overriding TimeZone
public java.lang.String shortFormat(java.util.TimeZone tz)
tz
- The overriding TimeZone
public java.lang.String format(java.util.TimeZone tz)
tz
- The overriding TimeZone
public java.lang.String format(java.lang.String fmt)
fmt
- The Date/Time format
public java.lang.String gmtFormat(java.lang.String fmt)
fmt
- The Date/Time format
public java.lang.String gmtFormat()
public java.lang.String gmtFormat(java.lang.String fmt, java.lang.StringBuffer sb)
fmt
- The Date/Time formatsb
- The StringBuffer where the formatted Date/Time is placed (may be null)
public java.lang.Object clone()
clone
in class java.lang.Object
public static java.lang.String encodeHourMinuteSecond(long tod, java.lang.String fmt)
tod
- The time-of-dayfmt
- The format
public static int parseHourMinuteSecond(java.lang.String hms)
hms
- The String containing the "hhhh:mm:ss" to parse
public static int parseHourMinuteSecond(java.lang.String hms, int dft)
hms
- The String containing the "hhhh:mm:ss" to parsedft
- The default seconds returned if unable to parse the specified String.
public static void main(java.lang.String[] argv)
argv
- Comand-line arguments
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |