|
JEphem site jephem API Build classes |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--tig.Dates
Class containing utility static methods for date manipulation.
Dates are represented as an array of integers.
The internationalization of this class is hard coded (French and English are supported).
This class handles :
dateToJd(), jdToDate()
).parseDate(), parseHour()
).formatDate(), formatHour()
).
Field Summary |
Fields inherited from interface tig.GeneralConstants |
BLANK, FS, LS, NO_SPECIF, SPACE |
Constructor Summary | |
Dates()
|
Method Summary | |
static double |
calcDecDay(int d,
int h,
int m,
int s)
Returns the decimal part of the day. |
static double |
dateToJd(int[] date)
Convenient method equivalent to dateToJd(int, int, int, int, int, int) . |
static double |
dateToJd(int year,
int month,
int day,
int hour,
int minut,
int sec)
Calculates the number of julian days elapsed since jan 0.5 4712 BC, from a date and an hour. |
static java.lang.String |
formatDate(int[] date,
java.lang.String lang)
Formats a date into a displayable String. |
static java.lang.String |
formatDate(java.lang.String strDate,
java.lang.String lang)
Facility method, calling parseDate() and formatDate(int[], String) . |
static java.lang.String |
formatHour(int[] hour,
java.lang.String lang)
Formats an hour into a displayable String. |
static java.lang.String |
formatHour(java.lang.String strHour,
java.lang.String lang)
Facility method, calling parseHour() and formatHour(int[], String) . |
static java.lang.String |
formatHourDate(int[] hourDate,
java.lang.String lang)
Formats a date and an hour into a displayable String. |
static java.lang.String |
formatHourDate(java.lang.String strDate,
java.lang.String strHour,
java.lang.String lang)
Facility method, calling parseHourDate() and formatHourDate(int[], String) . |
static boolean |
isLeapYear(int y)
Tests if y corresponds to a leap year. |
static int[] |
jdToDate(double jd)
Computes the date and hour corresponding to a julian day (nb of days elapsed since jan 0.5 4712 BC). |
static int[] |
now()
Returns an array containing date fields (in this order : year, month, day, hour, minuts, seconds) initialized to the current date. |
static int[] |
parseDate(java.lang.String strDate,
java.lang.String lang)
Transforms a date representated as a String to an array of integers containing the year, month, day. |
static int[] |
parseHour(java.lang.String strHour,
java.lang.String lang)
Transforms an hour representated as a String to an array of integers containing (in this order : hours, minutes, seconds. |
static int[] |
parseHourDate(java.lang.String strDate,
java.lang.String strHour,
java.lang.String lang)
Transforms a date and an hour representated as Strings to an array of integers containing (in this order : years, months, days, hours, minutes, seconds. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Dates()
Method Detail |
public static double dateToJd(int[] date)
dateToJd(int, int, int, int, int, int)
.
public static double dateToJd(int year, int month, int day, int hour, int minut, int sec)
public static int[] jdToDate(double jd)
jd
- A positive number expressing the julian day.
java.lang.RuntimeException
- If parameter 'jd' < 0.public static boolean isLeapYear(int y)
y
corresponds to a leap year.
y
- positive number representing the year to test.
y
is positive and corresponds to a leap year.public static int[] now()
public static java.lang.String formatHourDate(int[] hourDate, java.lang.String lang)
hourDate
- An array containing integers representing : year, month, day, hour, minut, second.lang
- language code, as specified by ISO-639 norm (supported languages : "en" and "fr").
java.lang.IllegalArgumentException
- if :
public static java.lang.String formatDate(int[] date, java.lang.String lang)
date
- An array containing 3 integers representing : year, month, day.lang
- language code, as specified by ISO-639 norm (supported languages : "en" and "fr").
java.lang.IllegalArgumentException
- if :
public static java.lang.String formatHour(int[] hour, java.lang.String lang)
hour
- An array containing 3 integers representing : hour, minut, second.
java.lang.IllegalArgumentException
- if :
public static java.lang.String formatHourDate(java.lang.String strDate, java.lang.String strHour, java.lang.String lang) throws DateFormatException, HourFormatException
parseHourDate()
and formatHourDate(int[], String)
.
DateFormatException
- if parameter 'strDate' is not correct.
HourFormatException
- if parameter 'strHour' is not correct.public static java.lang.String formatDate(java.lang.String strDate, java.lang.String lang) throws DateFormatException
parseDate()
and formatDate(int[], String)
.
DateFormatException
- if parameter 'strDate' is not correct.public static java.lang.String formatHour(java.lang.String strHour, java.lang.String lang) throws HourFormatException
parseHour()
and formatHour(int[], String)
.
HourFormatException
- if parameter 'strHour' is not correct.public static int[] parseHourDate(java.lang.String strDate, java.lang.String strHour, java.lang.String lang) throws DateFormatException, HourFormatException, java.lang.IllegalArgumentException
parseHour(String, String)
and parseDate(String, String)
.
See their documentation for informations about parameter formats and exception thrown.
DateFormatException
HourFormatException
java.lang.IllegalArgumentException
public static int[] parseDate(java.lang.String strDate, java.lang.String lang) throws DateFormatException, java.lang.IllegalArgumentException
strDate | years | months | days |
---|---|---|---|
18/07/1998 | 18 | 7 | 1998 |
18.007:1998 | 18 | 7 | 1998 |
9-10 2000 | 9 | 10 | 2000 |
9 10 1 | 9 | 10 | 1 |
9 10 -16 | 9 | 10 | -16 |
9-10--16 | 9 | 10 | -16 |
9-10-16 | 9 | 10 | 16 |
strDate | year | Month | Day |
---|---|---|---|
07/18/1998 | 18 | 7 | 1998 |
007:18.1998 | 18 | 7 | 1998 |
9-10 2000 | 10 | 9 | 2000 |
9 10 1 | 9 | 10 | 1 |
9 10 -16 | 10 | 9 | -16 |
9-10--16 | 10 | 9 | -16 |
9-10-16 | 10 | 9 | 16 |
strDate
- A String containing the date, as specified above.lang
- language code, as specified by ISO-639 norm (supported languages : "en" and "fr").
java.lang.IllegalArgumentException
- if parameter 'lang' is different from 'en' or 'fr'.
DateFormatException
- if parameter 'strDate' is not correctly formatted.public static int[] parseHour(java.lang.String strHour, java.lang.String lang) throws HourFormatException, java.lang.IllegalArgumentException
strHour | hours | minuts | seconds |
---|---|---|---|
(empty string) | 0 | 0 | 0 |
12 | 12 | 0 | 0 |
12h30m | 12 | 30 | 0 |
-12:30:40s | 12 | 30 | 40 |
000012h000030m00040 | 12 | 30 | 40 |
strHour
- A String containing the hour, as specified above..lang
- language code, as specified by ISO-639 norm (supported languages : 'en' and 'fr').
HourFormatException
- if parameter 'strHour' is not correctly formatted.
java.lang.IllegalArgumentException
- if parameter 'lang' is different from 'en' or 'fr'.public static double calcDecDay(int d, int h, int m, int s)
|
JEphem site jephem API Build classes |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |