public class JS4JDate extends Date implements Cloneable
| Modifier and Type | Field and Description |
|---|---|
static String |
CREATE_DATE_FORMAT
Format for parsing the create date string: 2004/08/04-07:23:15.987(-0400)
|
static String |
CREATE_DATE_FORMAT_0
Format for parsing the create date string: 2004/08/04-07:23:15.987 which
is assumed to be 0000 (Greenwich Mean Time).
|
static String |
CREATE_DATE_FORMAT_1
Format for parsing the create date string: 2004/08/04-07:23:15 which is
assumed to be 0000 (Greenwich Mean Time) with 0 milliseconds.
|
static String |
CREATE_DATE_FORMAT_10
Format for parsing the create date string: 2004/08/04 07:23:15.987123
which is assumed to be 0000 (Greenwich Mean Time).
|
static String |
CREATE_DATE_FORMAT_11
Format for parsing the create date string: Monday, 22 Sep 1959 08:12:34
which is assumed to be UTC (GMT)
|
static String |
CREATE_DATE_FORMAT_12
Format for parsing the create date string: January 05 2018 00:44:45
which is assumed to be UTC (GMT)
|
static String |
CREATE_DATE_FORMAT_2
Format for parsing the create date string: 2004/08/04-07:23 which is
assumed to be 0000 (Greenwich Mean Time) with 0 seconds and milliseconds.
|
static String |
CREATE_DATE_FORMAT_3
Format for parsing the create date string: 2004/08/04-07 which is assumed
to be 0000 (Greenwich Mean Time) with 0 minutes, seconds and milliseconds.
|
static String |
CREATE_DATE_FORMAT_4
Format for parsing the create date string: 2004/08/04 which is assumed to
be 0000 (Greenwich Mean Time) at midnight.
|
static String |
CREATE_DATE_FORMAT_5
Format for parsing the create date string: 2004/08/04-07:23:15(-0400)
which is assumed to be -0400 (Eastern Daylight Time) with 0 milliseconds.
|
static String |
CREATE_DATE_FORMAT_6
Format for parsing the create date string: 2004/08/04-07:23(-0400) which
is assumed to be -0400 (Eastern Daylight Time) with 0 seconds and
milliseconds.
|
static String |
CREATE_DATE_FORMAT_7
Format for parsing the create date string: 2004/08/04-07(-0400) which is
assumed to be -0400 (Eastern Daylight Time) with 0 minutes, seconds and
milliseconds.
|
static String |
CREATE_DATE_FORMAT_8
Format for parsing the create date string: 2004/08/04(-0400) which is
assumed to be -0400 (Eastern Daylight Time) at midnight.
|
static String |
CREATE_DATE_FORMAT_9
Format for parsing the create date string: 2004/08/04T07Z which is assumed
to be 07:00:00.000 Zulu (UTC) Time.
|
static String |
m_strClassName |
static String |
UNDEFINED_Aiden_DB2_Date_String
Intended to be equal to "1970-01-01 00:00:00.000001".
|
static JS4JDate |
UNDEFINED_JS4JDate
An undefined version of this object.
|
static long |
UNDEFINED_JS4JDate_Milliseconds
Number of milliseconds past the 1/1/70 midnight epoch used to define an
undefined date
|
| Constructor and Description |
|---|
JS4JDate()
Constructor forJS4JDate using the current date/time.
|
JS4JDate(Date date)
Constructor initializing the time to the date supplied.
|
JS4JDate(double dDate)
Constructor initializing the time to the value supplied.
|
JS4JDate(int iYear,
int iMonth,
int iDay,
int iHours,
int iMinutes,
int iSeconds,
int iMilliseconds,
String strTimeZone)
Create anJS4JDate object from the supplied date information.
|
JS4JDate(long lDate)
Constructor initializing the time to the value supplied.
|
JS4JDate(String strDate)
Create anJS4JDate object from theAiden formatted date string
|
| Modifier and Type | Method and Description |
|---|---|
JS4JDate |
clone() |
int |
compareTo(Date date) |
int |
compareTo(JS4JDate aaiDate)
Compares this date with the supplied date and returns -1 if this date is
less than the supplied date, 0 if equal, or 1 if greater than the supplied
date.
|
static String |
convertDateTime(String strDateTime)
Converts a String in xs:dateTime format toJS4JDate format
|
boolean |
equals(Object obj) |
long |
getDay(String strTimeZone)
Get the day of this date for the specified timezone.
|
static String |
getHexTime() |
long |
getHours(String strTimeZone)
Get the hours of this date for the specified timezone.
|
long |
getMilliseconds(String strTimeZone)
Get the milliseconds of this date for the specified timezone.
|
long |
getMinutes(String strTimeZone)
Get the minutesr of this date for the specified timezone.
|
long |
getMonth(String strTimeZone)
Get the month of this date for the specified timezone.
|
long |
getSeconds(String strTimeZone)
Get the seconds of this date for the specified timezone.
|
long |
getYear(String strTimeZone)
Get the year of this date for the specified timezone.
|
boolean |
isUndefined()
Tests for equality to the UNDEFINED_JS4JDate which is one second after the
epoch date (midnight 1/1/1970 GMT).
|
static boolean |
isUndefined(Date date)
Tests for equality to the UNDEFINED_JS4JDate which is one millisecond after
the epoch date (midnight 1/1/1970 GMT).
|
static boolean |
isUndefined(JS4JDate date)
Tests for equality to the UNDEFINED_JS4JDate which is one millisecond after
the epoch date (midnight 1/1/1970 GMT).
|
static Date |
makeDate(String strDate)
General purpose Date generator that parses multiple formats, supplying
default values if they are unspecified.
|
static String |
makeFormattedDate(Date date,
String strFormat,
String strTimeZone)
Create a formatted string showing the date in theAiden date format for 0000
(Greenwich Mean Time).
|
static String |
makeFormattedLocalDate(Date date)
Create a formatted string showing the local date in theAiden date format
|
static long |
MAX_TIME() |
static JS4JDate |
MAX_VALUE() |
static JS4JDate |
MIN_VALUE() |
static String |
parseTimeZoneFromListEntry(String strTimeZoneListEntry)
Find the timezone string by parsing the timezone list entry formed by the
getTimeZoneList routine.
|
void |
setDay(int iDay,
String strTimeZone)
Set the day of this date to the specified day.
|
void |
setHours(int iHours,
String strTimeZone)
Set the hours of this date to the specified hours.
|
void |
setMilliseconds(int iMilliseconds,
String strTimeZone)
Set the milliseconds of this date to the specified seconds.
|
void |
setMinutes(int iMinutes,
String strTimeZone)
Set the minutes of this date to the specified minutes.
|
void |
setMonth(int iMonth,
String strTimeZone)
Set the month of this date to the specified month.
|
void |
setSeconds(int iSeconds,
String strTimeZone)
Set the seconds of this date to the specified seconds.
|
void |
setYear(int iYear,
String strTimeZone)
Set the year of this date to the specified year.
|
Date |
toDate() |
String |
toString() |
String |
toString(String strTimeZone)
Return a String containing formatted date in the specified timezone.
|
String |
toString(String strFormat,
String strTimeZone)
Return a String containing formatted date in the specified timezone.
|
String |
toStringCookie() |
String |
toStringDateTime() |
String |
toStringDBTimestamp() |
static JS4JDate |
undefinedForNull(JS4JDate date)
Converts the inputJS4JDate to an undefinedJS4JDate if the inputJS4JDate is
null.
|
after, before, from, getDate, getDay, getHours, getMinutes, getMonth, getSeconds, getTime, getTimezoneOffset, getYear, hashCode, parse, setDate, setHours, setMinutes, setMonth, setSeconds, setTime, setYear, toGMTString, toInstant, toLocaleString, UTCpublic static String CREATE_DATE_FORMAT
public static String CREATE_DATE_FORMAT_0
public static String CREATE_DATE_FORMAT_1
public static String CREATE_DATE_FORMAT_10
public static String CREATE_DATE_FORMAT_11
public static String CREATE_DATE_FORMAT_12
public static String CREATE_DATE_FORMAT_2
public static String CREATE_DATE_FORMAT_3
public static String CREATE_DATE_FORMAT_4
public static String CREATE_DATE_FORMAT_5
public static String CREATE_DATE_FORMAT_6
public static String CREATE_DATE_FORMAT_7
public static String CREATE_DATE_FORMAT_8
public static String CREATE_DATE_FORMAT_9
public static String m_strClassName
public static final long UNDEFINED_JS4JDate_Milliseconds
public static final JS4JDate UNDEFINED_JS4JDate
public static final String UNDEFINED_Aiden_DB2_Date_String
public JS4JDate()
public JS4JDate(Date date)
date - the date for thisJS4JDate.public JS4JDate(double dDate)
dDate - the number of milliseconds since the epoch (midnight, 1/1/70
0000).public JS4JDate(int iYear,
int iMonth,
int iDay,
int iHours,
int iMinutes,
int iSeconds,
int iMilliseconds,
String strTimeZone)
throws Exception
iYear - 2, 3 or 4 digit year. If less than 4 digits, 2000 is added to
the supplied value.iMonth - number of the month where 1=January, 12=December.iDay - number of the day of the month where the first day is 1.iHours - hours within the day from 0 through 23.iMinutes - minutes within the hour from 0 through 59.iSeconds - seconds within the minute from 0 through 59.iMilliseconds - milliseconds within the second from 0 through 999.strTimeZone - the timezone (e.g., "+0000" is Greenwich Mean Time, "-0400" is
Eastern Daylight Time). If no timezone is supplied then "+0000"
is used as a default.Exception - if the values for Day is invalid for the Month, or if an
invalid Timezone is supplied (Exception), or if one of
the values is not within their allowed range
(ExceptionInvalidParam).public JS4JDate(long lDate)
lDate - the number of milliseconds since the epoch (midnight, 1/1/70
0000).public JS4JDate(String strDate) throws Exception
strDate - theAiden formatted date string to be transformed into theJS4JDate
object.Exception - Exception if the passed date does not comply
with the appropriate supported formats.
Exception if the date or time
components are not correct.CREATE_DATE_FORMAT,
CREATE_DATE_FORMAT_0,
CREATE_DATE_FORMAT_1,
CREATE_DATE_FORMAT_2,
CREATE_DATE_FORMAT_3,
CREATE_DATE_FORMAT_4,
CREATE_DATE_FORMAT_5,
CREATE_DATE_FORMAT_6,
CREATE_DATE_FORMAT_7,
CREATE_DATE_FORMAT_8,
CREATE_DATE_FORMAT_12public static String convertDateTime(String strDateTime)
strDateTime - String in xs:dateTime formatCREATE_DATE_FORMAT_0,
CREATE_DATE_FORMAT_1,
CREATE_DATE_FORMAT_2,
CREATE_DATE_FORMAT_3,
CREATE_DATE_FORMAT_4,
CREATE_DATE_FORMAT_5,
CREATE_DATE_FORMAT_6,
CREATE_DATE_FORMAT_7,
CREATE_DATE_FORMAT_8,
CREATE_DATE_FORMAT_9,
CREATE_DATE_FORMAT_10,
CREATE_DATE_FORMAT_11,
CREATE_DATE_FORMAT_12public static String getHexTime()
public static boolean isUndefined(JS4JDate date)
date - the date to be tested to see if it is undefinedDate.getTime() returns a value of
1LisUndefined(JS4JDate)public static boolean isUndefined(Date date)
date - the date to be tested to see if it is undefinedDate.getTime() returns a value of
1LisUndefined(JS4JDate)public static Date makeDate(String strDate) throws Exception
strDate - String containing the date information in one of theAiden date
formatsException - if the passed string doesn't match one of theAiden date formatsExceptionCREATE_DATE_FORMAT,
CREATE_DATE_FORMAT_0,
CREATE_DATE_FORMAT_1,
CREATE_DATE_FORMAT_2,
CREATE_DATE_FORMAT_3,
CREATE_DATE_FORMAT_4,
CREATE_DATE_FORMAT_5,
CREATE_DATE_FORMAT_6,
CREATE_DATE_FORMAT_7,
CREATE_DATE_FORMAT_8,
CREATE_DATE_FORMAT_9,
CREATE_DATE_FORMAT_10,
CREATE_DATE_FORMAT_11,
CREATE_DATE_FORMAT_12public static String makeFormattedDate(Date date, String strFormat, String strTimeZone)
date - the date to be transformed into the string.strFormat - the date format to be returned. If the format is illdefined, the
standardAiden Date format is used (CREATE_DATE_FORMAT).strTimeZone - the format of the timezone using +/-hhmmCREATE_DATE_FORMATpublic static String makeFormattedLocalDate(Date date)
date - the date to be transformed into the string.CREATE_DATE_FORMATpublic static long MAX_TIME()
public static JS4JDate MAX_VALUE()
public static JS4JDate MIN_VALUE()
public static String parseTimeZoneFromListEntry(String strTimeZoneListEntry)
strTimeZoneListEntry - the timezone list entry from the getTimeZoneList method
comprising the timezone offset from GMT followed by a space and
then the TimeZone ID. For example, "+0100 Europe/Paris" or
"-0500 EST" or "+0000 GMT" would return "+0100", "-0500", or
"+0000" respectively.public static JS4JDate undefinedForNull(JS4JDate date)
date - JS4JDate to be tested against null and converted.public int compareTo(JS4JDate aaiDate)
aaiDate - the date to compare against this datepublic int compareTo(Date date)
compareTo in interface Comparable<Date>compareTo in class Datepublic long getDay(String strTimeZone)
strTimeZone - the timezone for which the day applies. If this value is null or
empty, "+0000" is used.public long getHours(String strTimeZone)
strTimeZone - the timezone for which the hours apply. If this value is null or
empty, "+0000" is used.public long getMilliseconds(String strTimeZone)
strTimeZone - the timezone for which the milliseconds apply. If this value is
null or empty, "+0000" is used.public long getMinutes(String strTimeZone)
strTimeZone - the timezone for which the minutes apply. If this value is null
or empty, "+0000" is used.public long getMonth(String strTimeZone)
strTimeZone - the timezone for which the month applies. If this value is null
or empty, "+0000" is used.public long getSeconds(String strTimeZone)
strTimeZone - the timezone for which the seconds apply. If this value is null
or empty, "+0000" is used.public long getYear(String strTimeZone)
strTimeZone - the timezone for which the year applies. If this value is null
or empty, "+0000" is used.public boolean isUndefined()
isUndefined(JS4JDate)public void setDay(int iDay,
String strTimeZone)
iDay - the day of the month (first day is 1).strTimeZone - the timezone for which the day applies. If this value is null or
empty, "+0000" is used.public void setHours(int iHours,
String strTimeZone)
iHours - the hours within the day (0=midnight).strTimeZone - the timezone for which the hours apply. If this value is null or
empty, "+0000" is used.public void setMilliseconds(int iMilliseconds,
String strTimeZone)
iMilliseconds - the milliseconds within the second [0..999].strTimeZone - the timezone for which the milliseconds apply. If this value is
null or empty, "+0000" is used.public void setMinutes(int iMinutes,
String strTimeZone)
iMinutes - the minutes within the hour [0..59].strTimeZone - the timezone for which the minutes apply. If this value is null
or empty, "+0000" is used.public void setMonth(int iMonth,
String strTimeZone)
iMonth - the one-based counting month number (e.g., 1=January).strTimeZone - the timezone for which the month applies. If this value is null
or empty, "+0000" is used.public void setSeconds(int iSeconds,
String strTimeZone)
iSeconds - the seconds within the minute [0..59].strTimeZone - the timezone for which the seconds apply. If this value is null
or empty, "+0000" is used.public void setYear(int iYear,
String strTimeZone)
iYear - the complete, 4 digit year (yeah, Y10K bug... ;^)strTimeZone - the timezone for which the year applies. If this value is null
or empty, "+0000" is used.public Date toDate()
public String toString()
toString in class DatetoString(String)public String toString(String strTimeZone)
strTimeZone - the ID for a TimeZone, either an abbreviation such as "PST", a
full name such as "America/Los_Angeles", or a custom ID such as
"0000-8:00". Note that the support of abbreviations is for JDK
1.1.x compatibility only and full names should be used.toString()public String toString(String strFormat, String strTimeZone)
strFormat - the desired date format to be returned. If the format is
invalid, the standardAiden Date format is used
(CREATE_DATE_FORMAT).strTimeZone - the ID for a TimeZone, either an abbreviation such as "PST", a
full name such as "America/Los_Angeles", or a custom ID such as
"0000-8:00". Note that the support of abbreviations is for JDK
1.1.x compatibility only and full names should be used.toString(),
CREATE_DATE_FORMATpublic String toStringCookie()
toString(String)public String toStringDateTime()
toString(String)public String toStringDBTimestamp()
toString(String)Copyright © 2020. All rights reserved.