public class Tool4Date
extends java.lang.Object
Tool4Date
class provides methods for date computingModifier and Type | Field and Description |
---|---|
static long |
hoursDay |
static long |
millisecondsDay |
static long |
milliSecondsHour |
static long |
milliSecondsMinute |
static long |
milliSecondsSecons |
static long |
minutesHour |
static long |
secondsMinute |
Constructor and Description |
---|
Tool4Date()
The constructor
Tool4Date creates a new instance(object) of the class. |
Modifier and Type | Method and Description |
---|---|
java.util.Date |
calcEaster(java.lang.String year)
The method
calcEaster calculates the eatser day of a current year. |
java.util.ArrayList |
calcGMST(double C)
The method
calcGMST calculates the
greenwich mean sidereal time (GMST) at 0h of UT. |
java.util.ArrayList |
createFixHolidaysOfGermany(java.lang.String year)
The method
createFixHolidaysOfGermany creates the fix holidays of germany. |
java.util.ArrayList |
createNonFixHolidaysOfGermany(java.lang.String year)
The method
createNonFixHolidaysOfGermany creates the non fix holidays of germany. |
java.util.Date |
getAddedDays2Date(java.util.Date day2Begin,
long daysToAdd)
The method
getAddedDays2Date adds daycount to a given date. |
java.util.Date |
getAddedHours2Date(java.util.Date day2Begin,
long hoursToAdd)
The method
getAddedHours2Date adds hour count to a given date. |
java.util.Date |
getAddedMinutes2Date(java.util.Date day2Begin,
long minutesToAdd)
The method
getAddedMinutes2Date adds minutes count to a given date. |
java.util.Date |
getAddedMonths2Date(java.util.Date day2Begin,
long monthsToAdd)
The method
getAddedMonths2Date adds monthcount to a given date. |
java.util.Date |
getAddedYears2Date(java.util.Date day2Begin,
long yearsToAdd)
The method
getAddedYears2Date adds year count to a given date. |
java.util.Date |
getCurrDateOfYearWeek(java.lang.String year,
int week)
The method
getCurrDateOfYearWeek creates a date of monday with the given year and week of year. |
java.lang.String |
getCurrDay()
The method
getCurrDay creates a string with the current day. |
java.lang.String |
getCurrDay(java.util.Date date)
The method
getCurrDay creates a string with the given day. |
int |
getCurrDayOfMonth()
The method
getCurrDayOfMonth gets current day of month as int. |
int |
getCurrDayOfMonth(java.util.Date date)
The method
getCurrDayOfMonth gets current day of month as int with the given date. |
int |
getCurrDayOfWeek()
The method
getCurrDayOfWeek gets current day of week as int. |
int |
getCurrDayOfWeek(java.util.Date date)
The method
getCurrDayOfWeek gets current day of week as int with the given date. |
java.lang.String |
getCurrHour()
The method
getCurrHour creates a string with the current hour. |
java.lang.String |
getCurrHour(java.util.Date date)
The method
getCurrHour creates a string with the current hour. |
java.lang.String |
getCurrMinute()
The method
getCurrMinute creates a string with the current minute. |
java.lang.String |
getCurrMinute(java.util.Date date)
The method
getCurrMinute creates a string with the current minute. |
java.lang.String |
getCurrMonth()
The method
getCurrMonth creates a string with the current month. |
java.lang.String |
getCurrMonth(java.util.Date date)
The method
getCurrMonth creates a string with the given month. |
java.lang.String |
getCurrSecond()
The method
getCurrSecond creates a string with the current second. |
java.lang.String |
getCurrSecond(java.util.Date date)
The method
getCurrSecond creates a string with the current second. |
int |
getCurrUltimo()
The method
getCurrUltimo gets the last day of month. |
int |
getCurrUltimo(java.util.Date date)
The method
getCurrUltimo gets the last day of month. |
int |
getCurrWeekOfYear()
The method
getCurrWeekOfYear creates a int with the current week of year. |
int |
getCurrWeekOfYear(java.util.Date date)
The method
getCurrWeekOfYear creates a int with the given date. |
java.lang.String |
getCurrYear()
The method
getCurrYear creates a string with the current year. |
java.lang.String |
getCurrYear(java.util.Date date)
The method
getCurrYear creates a string with the given year. |
java.lang.String |
getDate2SqlString(java.util.Date date)
The method
getDate2SqlString converts a given date to sql-date. |
java.lang.String |
getDate2String(java.util.Date date,
java.lang.String datedef)
The method
getDate2String converts a date into a date as string. |
int |
getDaysBetweenDates(java.util.Date datestart,
java.util.Date dateend)
Deprecated.
|
int |
getDaysBetweenDatesGlobal(java.util.Date datestart,
java.util.Date dateend)
The method
getDaysBetweenDatesGlobal calculates the days between to dates. |
java.lang.String |
getDVDate(java.util.Date date)
The method
getDVDate creates a string with the current date in format yyyyMMdd |
int |
getNumberOfDays(int year,
int month)
The method
getNumberOfDays gets the number of days of a month. |
java.util.Date |
getString2Date(java.lang.String date,
java.lang.String datedef)
The method
getString2Date converts a date as string into a date. |
java.util.Date |
getString2Time(java.lang.String date)
The method
getString2Time converts a date as string into a date. |
java.util.Date |
getString2TimeStamp(java.lang.String date,
java.lang.String datedef)
The method
getString2Date converts a date as string into a date. |
java.lang.String |
getTime2String(java.util.Date date,
java.lang.String timedef)
The method
getTime2String converts a date into time as string. |
java.lang.String |
getTimeStamp2SQLString(java.util.Date date)
The method
getTimeStamp2SQLString converts a date into timestamp as string. |
java.lang.String |
getTimeStamp2String(java.util.Date date,
java.lang.String timestampdef)
The method
getTimeStamp2String converts a date into timestamp as string. |
java.lang.String |
makeSQLDate(java.lang.String dbms,
java.util.Date date)
The method
makeSQLDate converts a date into a date as string dbms-dependent. |
java.lang.String |
makeSQLDate(java.lang.String dbms,
java.lang.String date,
java.lang.String datedef)
The method
makeSQLDate converts a date as string into a date as string dbms-dependent. |
public static final long hoursDay
public static final long minutesHour
public static final long secondsMinute
public static final long milliSecondsSecons
public static final long milliSecondsMinute
public static final long milliSecondsHour
public static final long millisecondsDay
public Tool4Date()
Tool4Date
creates a new instance(object) of the class.public java.lang.String getCurrYear()
getCurrYear
creates a string with the current year.public java.lang.String getCurrYear(java.util.Date date)
getCurrYear
creates a string with the given year.date
- a date.public java.lang.String getCurrMonth()
getCurrMonth
creates a string with the current month.public java.lang.String getCurrMonth(java.util.Date date)
getCurrMonth
creates a string with the given month.date
- a date.public java.lang.String getCurrDay()
getCurrDay
creates a string with the current day.public java.lang.String getCurrDay(java.util.Date date)
getCurrDay
creates a string with the given day.date
- current date.public int getCurrDayOfWeek()
getCurrDayOfWeek
gets current day of week as int.public int getCurrDayOfWeek(java.util.Date date)
getCurrDayOfWeek
gets current day of week as int with the given date.date
- current date.public int getCurrDayOfMonth()
getCurrDayOfMonth
gets current day of month as int.public int getCurrDayOfMonth(java.util.Date date)
getCurrDayOfMonth
gets current day of month as int with the given date.date
- current date.public int getCurrWeekOfYear()
getCurrWeekOfYear
creates a int with the current week of year.public int getCurrWeekOfYear(java.util.Date date)
getCurrWeekOfYear
creates a int with the given date.date
- current date.public java.util.Date getCurrDateOfYearWeek(java.lang.String year, int week) throws java.lang.Exception
getCurrDateOfYearWeek
creates a date of monday with the given year and week of year.year
- current year.week
- current week.java.lang.Exception
- if error if errorpublic int getCurrUltimo()
getCurrUltimo
gets the last day of month.public int getCurrUltimo(java.util.Date date)
getCurrUltimo
gets the last day of month.date
- current date.public java.lang.String getCurrHour()
getCurrHour
creates a string with the current hour.public java.lang.String getCurrHour(java.util.Date date)
getCurrHour
creates a string with the current hour.date
- current date.public java.lang.String getCurrMinute()
getCurrMinute
creates a string with the current minute.public java.lang.String getCurrMinute(java.util.Date date)
getCurrMinute
creates a string with the current minute.date
- current date.public java.lang.String getCurrSecond()
getCurrSecond
creates a string with the current second.public java.lang.String getCurrSecond(java.util.Date date)
getCurrSecond
creates a string with the current second.date
- current date.public int getNumberOfDays(int year, int month)
getNumberOfDays
gets the number of days of a month.year.
- month.
- public int getDaysBetweenDatesGlobal(java.util.Date datestart, java.util.Date dateend)
getDaysBetweenDatesGlobal
calculates the days between to dates.datestart
- current date start.dateend
- current date end.public int getDaysBetweenDates(java.util.Date datestart, java.util.Date dateend)
getDaysBetweenDates
calculates the days between to dates in the same year.datestart
- current date start.dateend
- current date end.public java.lang.String getDVDate(java.util.Date date)
getDVDate
creates a string with the current date in format yyyyMMdddate
- a date.public java.util.Date getString2Date(java.lang.String date, java.lang.String datedef) throws java.lang.Exception
getString2Date
converts a date as string into a date.date
- as string.datedef
- the definition for date formating.java.lang.Exception
- if errorpublic java.util.Date getString2Time(java.lang.String date)
getString2Time
converts a date as string into a date.date
- as string.public java.util.Date getString2TimeStamp(java.lang.String date, java.lang.String datedef) throws java.lang.Exception
getString2Date
converts a date as string into a date.date
- as string.datedef
- the definition for date formating.java.lang.Exception
- if errorpublic java.lang.String getDate2String(java.util.Date date, java.lang.String datedef)
getDate2String
converts a date into a date as string.date
- a date.datedef
- the definition for date formating.public java.lang.String getTime2String(java.util.Date date, java.lang.String timedef)
getTime2String
converts a date into time as string.date
- a date.timedef
- the definition for time formating.public java.lang.String getTimeStamp2String(java.util.Date date, java.lang.String timestampdef)
getTimeStamp2String
converts a date into timestamp as string.date
- a date.timestampdef
- the definition for time formating.public java.lang.String getTimeStamp2SQLString(java.util.Date date)
getTimeStamp2SQLString
converts a date into timestamp as string.date
- a date.public java.lang.String getDate2SqlString(java.util.Date date)
getDate2SqlString
converts a given date to sql-date.date
- a date.public java.util.Date getAddedYears2Date(java.util.Date day2Begin, long yearsToAdd)
getAddedYears2Date
adds year count to a given date.day2Begin
- current date.yearsToAdd
- the years to be added.public java.util.Date getAddedMonths2Date(java.util.Date day2Begin, long monthsToAdd)
getAddedMonths2Date
adds monthcount to a given date.day2Begin
- current date.monthsToAdd
- the month to be added.public java.util.Date getAddedDays2Date(java.util.Date day2Begin, long daysToAdd)
getAddedDays2Date
adds daycount to a given date.day2Begin
- current date.daysToAdd
- the days to be added.public java.util.Date getAddedHours2Date(java.util.Date day2Begin, long hoursToAdd)
getAddedHours2Date
adds hour count to a given date.day2Begin
- current date.hoursToAdd
- the hours to be added.public java.util.Date getAddedMinutes2Date(java.util.Date day2Begin, long minutesToAdd)
getAddedMinutes2Date
adds minutes count to a given date.day2Begin
- current date.minutesToAdd
- the minutes to be added.public java.lang.String makeSQLDate(java.lang.String dbms, java.lang.String date, java.lang.String datedef) throws java.lang.Exception
makeSQLDate
converts a date as string into a date as string dbms-dependent.dbms
- name of database management system.date
- as string.datedef
- as string dbms-dependent.java.lang.Exception
- if errorpublic java.lang.String makeSQLDate(java.lang.String dbms, java.util.Date date) throws java.lang.Exception
makeSQLDate
converts a date into a date as string dbms-dependent.dbms
- name of database system.date
- a date.java.lang.Exception
- if errorpublic java.util.ArrayList createFixHolidaysOfGermany(java.lang.String year) throws java.lang.Exception
createFixHolidaysOfGermany
creates the fix holidays of germany.year
- the current year.java.lang.Exception
- if errorpublic java.util.ArrayList createNonFixHolidaysOfGermany(java.lang.String year) throws java.lang.Exception
createNonFixHolidaysOfGermany
creates the non fix holidays of germany.year
- the current year.java.lang.Exception
- if errorpublic java.util.Date calcEaster(java.lang.String year) throws java.lang.Exception
calcEaster
calculates the eatser day of a current year.year
- the current year.java.lang.Exception
- if errorpublic java.util.ArrayList calcGMST(double C) throws java.lang.Exception
calcGMST
calculates the
greenwich mean sidereal time (GMST) at 0h of UT.
see: s. ghedini, software for photometric astronomy,
willmann-bell inc., 1982, p. 7-8.C
- the current julian date in days for greenwich UT.java.lang.Exception
- if error