|
MDi JLib 1.7.4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.microdeveloper.common.date.EDate
public class EDate
Utilities to easily generate dates from simple calls. Simulates date functions typically found in PL/SQL to ease the transition to Java for Oracle developers.
Refer toSimpleDateFormat
or see setFormat(java.lang.String)
for information on format masks.
Constructor Summary | |
---|---|
EDate()
Creates a new instance of EDates initialized to the current Date. |
|
EDate(Date d)
Creates a new instance of EDate with an initial date specified by d |
|
EDate(Date d,
String format)
Creates a new instance of EDate with an initial date specified using the date format specified |
Method Summary | |
---|---|
static Date |
addDays(Date date,
int d)
Adds the given number of days to the given date and returns the result |
void |
addDays(int d)
Adds the given days to the current date established in this. |
static Date |
addHours(Date date,
int h)
Adds the given number of hours to the date given |
void |
addHours(int h)
Adds the given number of hours to the current time in this. |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a property change listener |
long |
daysBetween(Date start,
Date end)
Returns the number of days between two dates as a real number |
static Date |
epochToDate(int epochDate)
Converts an Epoch date to a Date object. |
Date |
getDate()
Gets the currently established date |
String |
getDate(String format,
String timeZone)
Returns the currently established date/time as a String using the format and time zone given |
String |
getDateFormatProperty()
Returns the current date format property |
static int |
getDays(GregorianCalendar g1,
GregorianCalendar g2)
Number of days between two Gregorian dates. |
EDateInterface |
geteDateInterface()
Returns the interface. |
static String |
getElapsedHMS(int timeInSeconds)
Creates a textual representaion of the time given as seconds in the form of "hh hour(s) mm minute(s) ss seconds(s)". |
static int |
getElapsedSeconds(Date startTime,
Date endTime)
Calculates the number of seconds between two dates. |
static long |
getElapsedSeconds(GregorianCalendar gc1,
GregorianCalendar gc2)
Calculates the number of seconds elapsed between two Gregorian dates |
int |
getEpochDate()
Returns the objects current date/time as an Epoch date/time |
String |
getGMTDate()
Returns the Greewich mean time as a String |
String |
getGMTDate(String format)
Returns the current GMT date time in the format given |
String |
getLocalDate()
Returns the current local date as a string |
static int |
getMonths(GregorianCalendar g1,
GregorianCalendar g2)
Number of months between two Gregorian dates. |
String |
getSysDate()
Returns the current system date (synonymous with the Oracle Sysdate function) |
String |
getSysDate(String format)
Returns the current date time in the format given |
String |
getSysZone()
Gets the zone for the system where the class is currently executing |
String |
getTimeZoneProperty()
Returns the current time zone property |
static String |
getToday()
Returns the current system date |
static String |
getToday(String format)
Returns the current system date |
String |
getUTCDate()
Returns the current UTC (universal coordinated) date as a string |
String |
getUTCDate(String format)
Returns the current UTC date time in the format given |
String |
getZoneDate(String timeZone)
Returns the current date time based on the timeZone given |
String |
getZoneDate(String format,
String timeZone)
Returns the current date time based on the timeZone given in the format given |
String |
getZoneList()
Returns a list of the available java time zones |
String |
minutes_to_time(double min)
Returns a string which represents the a time based on the number of minutes given. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a property change listener |
void |
resetTimeZone()
|
void |
setDate(Date d)
|
void |
setDate(String ds,
String format)
Sets the current date of this to the date String given based on the format given. |
void |
setDateFormatProperty(String value)
Sets the current date format property |
void |
setEpochDate(int epochDate)
Sets the current date time of the object to the given Epoch time |
void |
setFormat(String format)
Sets the default format mask used for Date string operations. |
void |
setNow()
Sets the date/time of the instanciated object to the current dat/time |
void |
setTimeZoneProperty(String value)
Sets the current time zone property |
static Date |
subtractDays(Date date,
int d)
Subtracts the given number of days from the given date |
void |
subtractDays(int d)
Subtracts the given number of days from this. |
static Date |
subtractHours(Date date,
int h)
Subtracts a given number of hours from the given date |
void |
subtractHours(int h)
Subtracts the given number of hours from this. |
static Date |
toDate(String ds,
String format)
Converts a given String to a Date object using the format given |
int |
toEpoch()
Converts the current objects Date to an Epoch date |
static int |
toEpoch(Date d)
Converts the given date to an Epoch date |
String |
toString()
Returns this object as a String |
String |
toString(String format)
Returns this object as a String in the format given |
static String |
toString(String format,
Date d,
TimeZone tz)
Converts a given date into a String using the format given for the specified time zone. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public EDate()
public EDate(Date d)
d
- the date to initialize the EDate object topublic EDate(Date d, String format)
d
- the date to initialize the EDate object toformat
- the default date format to use for this objectMethod Detail |
---|
public void setFormat(String format)
Letter | Date or Time Component | Presentation | Examples |
---|---|---|---|
G
| Era designator | Text | AD
|
y
| Year | Year | 1996 ; 96
|
M
| Month in year | Month | July ; Jul ; 07
|
w
| Week in year | Number | 27
|
W
| Week in month | Number | 2
|
D
| Day in year | Number | 189
|
d
| Day in month | Number | 10
|
F
| Day of week in month | Number | 2
|
E
| Day in week | Text | Tuesday ; Tue
|
a
| Am/pm marker | Text | PM
|
H
| Hour in day (0-23) | Number | 0
|
k
| Hour in day (1-24) | Number | 24
|
K
| Hour in am/pm (0-11) | Number | 0
|
h
| Hour in am/pm (1-12) | Number | 12
|
m
| Minute in hour | Number | 30
|
s
| Second in minute | Number | 55
|
S
| Millisecond | Number | 978
|
z
| Time zone | General time zone | Pacific Standard Time ; PST ; GMT-08:00
|
Z
| Time zone | RFC 822 time zone | -0800
|
format
- public void setDate(Date d)
public static String toString(String format, Date d, TimeZone tz)
format
- java date mask formatd
- date to converttz
- timezone to use for the conversion
public String getDate(String format, String timeZone)
format
- java date mask formattimeZone
- timezone to use for the conversion
public static Date addDays(Date date, int d)
date
- d
- number of days to add to the given date
public static Date addHours(Date date, int h)
date
- date to incrementh
- hours to increment by
public static Date subtractDays(Date date, int d)
date
- the date to subtract fromd
- number of days to subtract
public static Date subtractHours(Date date, int h)
date
- the date to subtract fromh
- number of hours to subtract
public void resetTimeZone()
public static Date toDate(String ds, String format)
ds
- Date/time expressed as a Stringformat
- format to use in decoding the date String
public static int toEpoch(Date d)
d
- Date to convert
public static Date epochToDate(int epochDate)
epochDate
- date expressed as an epoch date (an integer)
public static int getElapsedSeconds(Date startTime, Date endTime)
startTime
- starting time as a Date objectendTime
- ending time as a Date object
public static int getDays(GregorianCalendar g1, GregorianCalendar g2)
g1
- first Gregorian dateg2
- second Gregorian date
public static int getMonths(GregorianCalendar g1, GregorianCalendar g2)
g1
- first Gregorian dateg2
- second Gregorian date
public static String getElapsedHMS(int timeInSeconds)
timeInSeconds
- seconds to convert
public static long getElapsedSeconds(GregorianCalendar gc1, GregorianCalendar gc2)
gc1
- first Gregorian dategc2
- second Gregorian date
public EDateInterface geteDateInterface()
public String getDateFormatProperty()
public void setDateFormatProperty(String value)
value
- date format to usepublic String getTimeZoneProperty()
public void setTimeZoneProperty(String value)
value
- the time zone to usepublic static String getToday()
public static String getToday(String format)
format
- java date mask format to use which overrides the default format
public String getSysDate()
public String getLocalDate()
public String getUTCDate()
public String getGMTDate()
public String getSysDate(String format)
format
- java date mask format to use which overrides the current property
getSysDate()
public String getUTCDate(String format)
format
- java date mask format to use which overrides the current property
getUTCDate()
public String getGMTDate(String format)
format
- java date mask format to use which overrides the current property
getGMTDate()
public String getZoneDate(String timeZone)
timeZone
- java Timezone to use
public String getZoneDate(String format, String timeZone)
timeZone
- java Timezone to useformat
- java date mask format to use which overrides the current property
public String getZoneList()
public String getSysZone()
public void addPropertyChangeListener(PropertyChangeListener listener)
listener
- the listener to addpublic void removePropertyChangeListener(PropertyChangeListener listener)
listener
- the listener to removepublic Date getDate()
public void setNow()
public String toString()
toString
in class Object
public String toString(String format)
format
- format to use
public void addDays(int d)
d
- days to addpublic void addHours(int h)
h
- hours to addpublic void subtractHours(int h)
h
- hours to subtractpublic void subtractDays(int d)
d
- days to subtractpublic String minutes_to_time(double min)
min
- minutes to convert
public void setDate(String ds, String format)
ds
- Date/time as a Stringformat
- format for the given Date/time to use in decoding the Stringpublic int toEpoch()
getEpochDate()
public int getEpochDate()
toEpoch()
public void setEpochDate(int epochDate)
epochDate
- date/time expressed as an Epoch datepublic long daysBetween(Date start, Date end)
start
- first dateend
- second date
|
MDi JLib 1.7.4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |