|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Calendar
java.util.GregorianCalendar
fr.tireme.schemadoc.xs2dtd.utils.DateTime
public class DateTime
A DateTime object is used to manage Date in the system and to ensure sql date format compatibility
| Field Summary |
|---|
| Fields inherited from class java.util.GregorianCalendar |
|---|
AD, BC |
| Fields inherited from class java.util.Calendar |
|---|
ALL_STYLES, AM, AM_PM, APRIL, AUGUST, DATE, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, DAY_OF_YEAR, DECEMBER, DST_OFFSET, ERA, FEBRUARY, FIELD_COUNT, FRIDAY, HOUR, HOUR_OF_DAY, JANUARY, JULY, JUNE, LONG, MARCH, MAY, MILLISECOND, MINUTE, MONDAY, MONTH, NOVEMBER, OCTOBER, PM, SATURDAY, SECOND, SEPTEMBER, SHORT, SUNDAY, THURSDAY, TUESDAY, UNDECIMBER, WEDNESDAY, WEEK_OF_MONTH, WEEK_OF_YEAR, YEAR, ZONE_OFFSET |
| Constructor Summary | |
|---|---|
DateTime()
The object is initialized with the current date |
|
DateTime(java.util.Date date)
Initialize this DateTime object with a date one |
|
DateTime(java.lang.String dateTime)
The object is initizialized with the given datetime String which comes form the database. |
|
| Method Summary | |
|---|---|
java.lang.String |
account()
Account representation of the DateTime object (month - day) |
void |
addDay(int day)
Add a day |
void |
addDayOfYear(int day)
Add a day |
void |
addHour(int hour)
Add an hour |
void |
addMinute(int minute)
Add a minute |
void |
addMonth(int month)
Add a month |
void |
addSecond(int second)
Add a second |
void |
addWeekOfYear(int day)
Add a week |
void |
addYear(int year)
Add a year |
java.lang.String |
compact()
Compact representation of the DateTime object which can be re-used to rebuild the DateTime object |
java.lang.String |
date()
|
int |
difference(DateTime date)
To compute the difference (in days) between this date and the other date. |
long |
differenceInMillis(DateTime date)
Compute the difference in milliseconds |
static java.lang.String |
duration(DateTime date1,
DateTime date2)
Work for duration less then 24h |
static int |
durationInSecond(DateTime date1,
DateTime date2)
Work for duration less then 24h |
java.lang.String |
file()
Representation for file of the DateTime object |
int |
getDay()
Get day |
int |
getDayOfWeek()
Get day ofthe week |
int |
getHour()
Get hour |
int |
getMinute()
Get minute |
int |
getMonth()
Get month |
int |
getTimeInSecond()
Get the time in milliseconds |
int |
getTimeInSecond(DateTime date)
Get the time in milliseconds |
int |
getYear()
Get year |
static void |
init(int gmt)
Initialize object. |
void |
setBeginOfDay()
Set the beginning of the day (00:00:00) |
void |
setDay(int day)
Set day |
void |
setEndOfDay()
Set the end of the day (23:59:59) |
void |
setFirstDayOfMonth(int firstDay)
Set the first day of the month (SUNDAY, MONDAY ..) |
void |
setHour(int hour)
Set hour |
void |
setHourOfDay(int hour)
Set the Hour of Day(0-23,24 means changing of day) (minutes,seconds .. are set to 0) |
void |
setMinute(int minute)
Set minute |
void |
setMonth(int month)
Set month |
static void |
setNewDateFormat(java.text.DateFormat newDateFormat)
To set a new DateFormat |
static void |
setNewTimeZone(java.util.TimeZone newTimeZone)
To set a new TimeZone |
void |
setYear(int year)
|
java.lang.String |
toSql()
Sql representation of the DataTime object to put in the database |
java.lang.String |
toSqlDate()
|
java.lang.String |
toString()
External representation of the DateTime object |
| Methods inherited from class java.util.GregorianCalendar |
|---|
add, clone, equals, getActualMaximum, getActualMinimum, getGreatestMinimum, getGregorianChange, getLeastMaximum, getMaximum, getMinimum, getTimeZone, hashCode, isLeapYear, roll, roll, setGregorianChange, setTimeZone |
| Methods inherited from class java.util.Calendar |
|---|
after, before, clear, clear, compareTo, get, getAvailableLocales, getDisplayName, getDisplayNames, getFirstDayOfWeek, getInstance, getInstance, getInstance, getInstance, getMinimalDaysInFirstWeek, getTime, getTimeInMillis, isLenient, isSet, set, set, set, set, setFirstDayOfWeek, setLenient, setMinimalDaysInFirstWeek, setTime, setTimeInMillis |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DateTime()
public DateTime(java.lang.String dateTime)
dateTime - String formatpublic DateTime(java.util.Date date)
date - Date format| Method Detail |
|---|
public static void init(int gmt)
gmt - offsetpublic java.lang.String toSql()
public java.lang.String toSqlDate()
public java.lang.String toString()
toString in class java.util.Calendarpublic java.lang.String date()
public java.lang.String compact()
public java.lang.String account()
public java.lang.String file()
public static java.lang.String duration(DateTime date1,
DateTime date2)
date1 - - start timedate2 - - end time
public static int durationInSecond(DateTime date1,
DateTime date2)
date1 - - start timedate2 - - end time
public static void setNewDateFormat(java.text.DateFormat newDateFormat)
newDateFormat - public static void setNewTimeZone(java.util.TimeZone newTimeZone)
newTimeZone - public int difference(DateTime date)
date - the second argument
public long differenceInMillis(DateTime date)
date - the second argument
public void setHourOfDay(int hour)
public void setEndOfDay()
public void setBeginOfDay()
public void setFirstDayOfMonth(int firstDay)
firstDay - public int getTimeInSecond(DateTime date)
date - - the date to convert
public int getTimeInSecond()
public void addSecond(int second)
second - - the minute to addpublic void addMinute(int minute)
minute - - the minute to addpublic void addHour(int hour)
hour - - the hour to addpublic void addDay(int day)
day - - the day to addpublic void addDayOfYear(int day)
day - - the day to addpublic void addWeekOfYear(int day)
day - - the day to addpublic void addMonth(int month)
month - - the month to addpublic void addYear(int year)
year - - the year to addpublic void setMinute(int minute)
minute - - the minute to setpublic void setHour(int hour)
hour - - the hour to setpublic void setDay(int day)
day - - the day to setpublic void setMonth(int month)
month - - the month to setpublic void setYear(int year)
year - public int getMinute()
public int getHour()
public int getDay()
public int getDayOfWeek()
public int getMonth()
public int getYear()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||