|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjodd.datetime.TimeUtil
Date time calculations and utilities. TimeUtil
is used by
JDateTime
and it contains few utilities that may be used
elswhere, although JDateTime
is recomended for all time
manipulation.
Constructor Summary | |
TimeUtil()
|
Method Summary | |
static int |
dayOfYear(int year,
int month,
int day)
Calculates day of year from given time stamp. |
static DateTimeStamp |
fromJulianDate(double JD)
Calculates time stamp from Astronomical Julian Date. |
static DateTimeStamp |
fromJulianDate(JulianDateStamp jds)
Calculates time stamp from Astronomical Julian Date. |
static int |
getMonthLength(int year,
int m)
Returns the length of the specified month in days. |
static boolean |
isLeapYear(int y)
Check if the given year is leap year. |
static boolean |
isValidDate(int year,
int month,
int day)
Checks if date is valid. |
static boolean |
isValidDateTime(DateTimeStamp dts)
Checks if date and time are valid. |
static boolean |
isValidDateTime(int year,
int month,
int day,
int hour,
int minute,
double second)
Checks if date and time are valid. |
static boolean |
isValidTime(int hour,
int minute,
double second)
Checks if time is valid. |
static JulianDateStamp |
toJulianDate(DateTimeStamp time)
Calculates Astronomical Julian Date from given time stamp. |
static JulianDateStamp |
toJulianDate(int year,
int month,
int day,
int hour,
int minute,
double second)
Calculates Astronomical Julian Date from given time. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TimeUtil()
Method Detail |
public static int dayOfYear(int year, int month, int day)
year
- month
- day
-
public static boolean isLeapYear(int y)
y
- year to check
true
if the year is a leap yearpublic static int getMonthLength(int year, int m)
year
- yearm
- month
public static boolean isValidDate(int year, int month, int day)
year
- year to checkmonth
- month to checkday
- day to check
public static boolean isValidTime(int hour, int minute, double second)
hour
- hour to checkminute
- minute to checksecond
- second to check
public static boolean isValidDateTime(int year, int month, int day, int hour, int minute, double second)
year
- year to checkmonth
- month to checkday
- day to checkhour
- hour to checkminute
- minute to checksecond
- second to check
public static boolean isValidDateTime(DateTimeStamp dts)
dts
- date/time stamp
public static JulianDateStamp toJulianDate(DateTimeStamp time)
time
-
public static JulianDateStamp toJulianDate(int year, int month, int day, int hour, int minute, double second)
Astronomical Julian Dates are counting from noon of the January 1st, -4712 (julian date 0 is -4712/01/01 12:00:00). Zero year exist. Julian Date is always GMT, there are no timezones.
Algorithm based on Numerical Recipesin C, 2nd ed., Cambridge University Press 1992, modified and enhanced by Igor Spasic.
year
- yearmonth
- monthday
- dayhour
- hourminute
- minutesecond
- second
public static DateTimeStamp fromJulianDate(double JD)
JD
- julian date
public static DateTimeStamp fromJulianDate(JulianDateStamp jds)
jds
- julian date stamp
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |