| java.lang.Object jodd.datetime.TimeUtil
TimeUtil | public class TimeUtil (Code) | | 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.
|
Method Summary | |
public static int | dayOfYear(int year, int month, int day) Calculates day of year from given time stamp. | public static DateTimeStamp | fromJulianDate(double JD) Calculates time stamp from Astronomical Julian Date. | public static DateTimeStamp | fromJulianDate(JulianDateStamp jds) Calculates time stamp from Astronomical Julian Date. | public static int | getMonthLength(int year, int m) Returns the length of the specified month in days. | public static boolean | isLeapYear(int y) Check if the given year is leap year. | public static boolean | isValidDate(int year, int month, int day) Checks if date is valid. | public static boolean | isValidDateTime(int year, int month, int day, int hour, int minute, double second) Checks if date and time are valid. | public static boolean | isValidDateTime(DateTimeStamp dts) Checks if date and time are valid. | public static boolean | isValidTime(int hour, int minute, double second) Checks if time is valid. | public static JulianDateStamp | toJulianDate(DateTimeStamp time) Calculates Astronomical Julian Date from given time stamp. | public static JulianDateStamp | toJulianDate(int year, int month, int day, int hour, int minute, double second) Calculates Astronomical Julian Date from given time.
Astronomical Julian Dates are counting from noon of the January 1st, -4712
(julian date 0 is -4712/01/01 12:00:00). |
MILLIS_IN_DAY | final public static long MILLIS_IN_DAY(Code) | | |
dayOfYear | public static int dayOfYear(int year, int month, int day)(Code) | | Calculates day of year from given time stamp.
It may not work for some dates in 1582.
day of year in range: [1-366] |
fromJulianDate | public static DateTimeStamp fromJulianDate(double JD)(Code) | | Calculates time stamp from Astronomical Julian Date.
Parameters: JD - julian date time stamp |
fromJulianDate | public static DateTimeStamp fromJulianDate(JulianDateStamp jds)(Code) | | Calculates time stamp from Astronomical Julian Date.
Algorithm based on Numerical Recipesin C, 2nd ed., Cambridge University
Press 1992.
Parameters: jds - julian date stamp time stamp |
getMonthLength | public static int getMonthLength(int year, int m)(Code) | | Returns the length of the specified month in days. Month is 1 for January
and 12 for December.
length of the specified month in days |
isLeapYear | public static boolean isLeapYear(int y)(Code) | | Check if the given year is leap year.
true if the year is a leap year |
isValidDate | public static boolean isValidDate(int year, int month, int day)(Code) | | Checks if date is valid.
true if date is valid, otherwise false |
isValidDateTime | public static boolean isValidDateTime(int year, int month, int day, int hour, int minute, double second)(Code) | | Checks if date and time are valid.
Parameters: year - year to check Parameters: month - month to check Parameters: day - day to check Parameters: hour - hour to check Parameters: minute - minute to check Parameters: second - second to check true if date and time are valid, otherwise false |
isValidDateTime | public static boolean isValidDateTime(DateTimeStamp dts)(Code) | | Checks if date and time are valid.
Parameters: dts - date/time stamp true if date and time are valid, otherwise false |
isValidTime | public static boolean isValidTime(int hour, int minute, double second)(Code) | | Checks if time is valid.
Parameters: hour - hour to check Parameters: minute - minute to check Parameters: second - second to check true if time is valid, otherwise false |
toJulianDate | public static JulianDateStamp toJulianDate(int year, int month, int day, int hour, int minute, double second)(Code) | | Calculates Astronomical Julian Date from given time.
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.
Parameters: year - year Parameters: month - month Parameters: day - day Parameters: hour - hour Parameters: minute - minute Parameters: second - second julian time stamp |
|
|