public class JulianDate extends java.lang.Object implements java.lang.Comparable<JulianDate>
Modifier and Type | Field and Description |
---|---|
static int |
APRIL
Integer Month - April
|
static int |
AUGUST
Integer Month - August
|
static int |
DECEMBER
Integer Month - December
|
static int |
FEBRUARY
Integer Month - February
|
static int |
FRIDAY
Days of the week - Friday
|
static int |
JANUARY
Integer Month - January
|
static int |
JULY
Integer Month - July
|
static int |
JUNE
Integer Month - June
|
static int |
LEFT_INCLUDE
LEFT_INCLUDE includes the start date in the Feb29 check
|
static int |
MARCH
Integer Month - March
|
static int |
MAY
Integer Month - May
|
static int |
MONDAY
Days of the week - Monday
|
static int |
NOVEMBER
Integer Month - November
|
static int |
OCTOBER
Integer Month - October
|
static int |
RIGHT_INCLUDE
RIGHT_INCLUDE includes the end date in the Feb29 check
|
static int |
SATURDAY
Days of the week - Saturday
|
static int |
SEPTEMBER
Integer Month - September
|
static int |
SUNDAY
Days of the week - Sunday
|
static int |
THURSDAY
Days of the week - Thursday
|
static int |
TUESDAY
Days of the week - Tuesday
|
static int |
WEDNESDAY
Days of the week - Wednesday
|
Constructor and Description |
---|
JulianDate(double dblJulian)
Create JulianDate from a double Julian
|
Modifier and Type | Method and Description |
---|---|
JulianDate |
addBusDays(int iDays,
java.lang.String strCalendarSet)
Add the given number of business days and returns a new JulianDate
|
JulianDate |
addDays(int iDays)
Add the given number of days and returns a new JulianDate
|
JulianDate |
addMonths(int iNumMonths)
Add the given number of months and returns a new JulianDate
|
JulianDate |
addTenor(java.lang.String strTenor)
Adds the tenor to the JulianDate to create a new date
|
JulianDate |
addYears(int iNumYears)
Add the given number of years and returns a new JulianDate
|
int |
compareTo(JulianDate dtOther) |
static boolean |
ContainsFeb29(double dblStart,
double dblEnd,
int iIncludeSide)
Indicates whether there is at least one leap day between 2 given Julian dates
|
static JulianDate |
CreateFromDDMMMYYYY(java.lang.String strDate)
Creates a JulianDate from a string containing date in the DDMMYYYY format
|
static JulianDate |
CreateFromYMD(int iYear,
int iMonth,
int iDay)
Creates a JulianDate from year, month, and date
|
static int |
Day(double dblJulianIn)
Returns the day corresponding to the Julain double
|
int |
daysDiff(JulianDate dt)
Difference in days between the current and the input date
|
static double |
DaysElapsed(double dblDate)
Numbers of days elapsed in the year represented by the given Julian date
|
static int |
DaysInMonth(int iMonth,
int iYear)
Gets the maximum number of days in the given month and year
|
static double |
DaysRemaining(double dblDate)
Returns the number of days remaining in the year represented by the given Julian year
|
boolean |
equals(java.lang.Object o) |
static java.lang.String |
fromJulian(double dblJulianIn)
Creates a MM/DD/YYYY string from the input Julian double
|
static java.lang.String |
getDayChars(int iDay)
Gets the english word for day corresponding to the input integer
|
JulianDate |
getFirstEDFStartDate(int iNumRollMonths)
Generates the First EDSF start date from this JulianDate
|
double |
getJulian()
Returns the double Julian
|
static java.lang.String |
getMonthChar(int iMonth)
Returns the english word corresponding to the input integer month
|
static java.lang.String |
getMonthOracleChar(int iMonth)
Returns the Oracle DB trigram corresponding to the input integer month
|
int |
hashCode() |
static boolean |
IsEOM(double dblDate)
Indicates if the given Julian double corresponds to an end of month day
|
static boolean |
IsLeapYear(double dblDate)
Indicates if the year in the given Julian date is a leap year
|
static void |
main(java.lang.String[] astrArgs) |
static int |
Month(double dblJulianIn)
Return the month given the date represented by the Julian double.
|
static int |
MonthFromMonthChars(java.lang.String strMonth)
Converts the month trigram/word to the corresponding month integer
|
static int |
NumFeb29(double dblStart,
double dblEnd,
int iIncludeSide)
Calculates how many leap days exist between the 2 given Julian days
|
JulianDate |
subtractBusDays(int iDays,
java.lang.String strCalendarSet)
Subtract the given number of business days and returns a new JulianDate
|
JulianDate |
subtractDays(int iDays)
Subtracts the given number of days and returns a new JulianDate
|
JulianDate |
subtractTenor(java.lang.String strTenor)
Subtracts the tenor to the JulianDate to create a new date
|
static JulianDate |
Today()
Returns a Julian Date corresponding to today
|
static double |
toJulian(int iYear,
int iMonth,
int iDay)
Converts YMD to a Julian double.
|
java.lang.String |
toOracleDate()
Returns a trigram representation of date
|
java.lang.String |
toString() |
static int |
Year(double dblJulianIn)
Returns the year corresponding to the Julian double
|
public static final int LEFT_INCLUDE
public static final int RIGHT_INCLUDE
public static final int MONDAY
public static final int TUESDAY
public static final int WEDNESDAY
public static final int THURSDAY
public static final int FRIDAY
public static final int SATURDAY
public static final int SUNDAY
public static final int JANUARY
public static final int FEBRUARY
public static final int MARCH
public static final int APRIL
public static final int MAY
public static final int JUNE
public static final int JULY
public static final int AUGUST
public static final int SEPTEMBER
public static final int OCTOBER
public static final int NOVEMBER
public static final int DECEMBER
public JulianDate(double dblJulian) throws java.lang.Exception
dblJulian
- Double representing the JulianDatejava.lang.Exception
- Thrown if the input date is invalidpublic static double toJulian(int iYear, int iMonth, int iDay)
iYear
- YeariMonth
- MonthiDay
- Daypublic static java.lang.String fromJulian(double dblJulianIn)
dblJulianIn
- double representing Julian datepublic static int Year(double dblJulianIn) throws java.lang.Exception
dblJulianIn
- double representing the Julian datejava.lang.Exception
- thrown if the input date in invalidpublic static int Month(double dblJulianIn) throws java.lang.Exception
dblJulianIn
- double representing the Julian datejava.lang.Exception
- thrown if input date is invalidpublic static int Day(double dblJulianIn) throws java.lang.Exception
dblJulianIn
- double representing the Julian datejava.lang.Exception
- thrown if input date is invalidpublic static final double DaysElapsed(double dblDate) throws java.lang.Exception
dblDate
- Double representing the Julian datejava.lang.Exception
- Thrown if the input date is invalidpublic static final double DaysRemaining(double dblDate) throws java.lang.Exception
dblDate
- Double representing the Julian datejava.lang.Exception
- Thrown if input date is invalidpublic static final boolean IsLeapYear(double dblDate) throws java.lang.Exception
dblDate
- Double representing the input Julian datejava.lang.Exception
- Thrown if input date is invalidpublic static final boolean ContainsFeb29(double dblStart, double dblEnd, int iIncludeSide) throws java.lang.Exception
dblStart
- Double representing the starting Julian datedblEnd
- Double representing the ending Julian dateiIncludeSide
- INCLUDE_LEFT or INCLUDE_RIGHT indicating whether the starting date, the ending
date, or both dates are to be includedjava.lang.Exception
- If inputs are invalidpublic static final int NumFeb29(double dblStart, double dblEnd, int iIncludeSide) throws java.lang.Exception
dblStart
- Double representing the starting Julian datedblEnd
- Double representing the ending Julian dateiIncludeSide
- INCLUDE_LEFT or INCLUDE_RIGHT indicating whether the starting date, the ending
date, or both dates are to be includedjava.lang.Exception
- Thrown if the inputs are invalidpublic static java.lang.String getMonthChar(int iMonth) throws java.lang.Exception
iMonth
- Integer representing the monthjava.lang.Exception
- Thrown if the input month is invalidpublic static java.lang.String getMonthOracleChar(int iMonth) throws java.lang.Exception
iMonth
- Integer representing the monthjava.lang.Exception
- thrown if the input month is invalidpublic static int MonthFromMonthChars(java.lang.String strMonth) throws java.lang.Exception
strMonth
- Month trigram or english wordjava.lang.Exception
- Thrown on invalid input monthpublic static java.lang.String getDayChars(int iDay) throws java.lang.Exception
iDay
- Integer representing the dayjava.lang.Exception
- Thrown if the input day is invalidpublic static int DaysInMonth(int iMonth, int iYear) throws java.lang.Exception
iMonth
- Integer representing the monthiYear
- Integer representing the yearjava.lang.Exception
- Thrown if inputs are invalidpublic static final boolean IsEOM(double dblDate) throws java.lang.Exception
dblDate
- Double representing the Julain datejava.lang.Exception
- Thrown if input date is invalidpublic static final JulianDate Today()
public static final JulianDate CreateFromYMD(int iYear, int iMonth, int iDay)
iYear
- Integer yeariMonth
- Integer monthiDay
- Integer daypublic static final JulianDate CreateFromDDMMMYYYY(java.lang.String strDate)
strDate
- String containing date in the DDMMYYYY formatpublic double getJulian()
public JulianDate addDays(int iDays)
iDays
- Integer representing the number of days to be addedpublic JulianDate subtractDays(int iDays)
iDays
- Integer representing the number of days to be subtractedpublic JulianDate addBusDays(int iDays, java.lang.String strCalendarSet)
iDays
- Integer representing the number of days to be subtractedstrCalendarSet
- String representing the calendar set containing the business dayspublic JulianDate subtractBusDays(int iDays, java.lang.String strCalendarSet)
iDays
- Integer representing the number of days to be subtractedstrCalendarSet
- String representing the calendar set containing the business dayspublic JulianDate addYears(int iNumYears)
iNumYears
- Integer representing the number of years to be addedpublic JulianDate addMonths(int iNumMonths)
iNumMonths
- Integer representing the number of months to be addedpublic JulianDate getFirstEDFStartDate(int iNumRollMonths)
iNumRollMonths
- Integer representing number of months to rollpublic JulianDate addTenor(java.lang.String strTenor)
strTenor
- String representing the tenor to addpublic JulianDate subtractTenor(java.lang.String strTenor)
strTenor
- String representing the tenor to addpublic int daysDiff(JulianDate dt) throws java.lang.Exception
dt
- JulianDate representing the input datejava.lang.Exception
- Thrown if input date is invalidpublic java.lang.String toOracleDate()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public int compareTo(JulianDate dtOther)
compareTo
in interface java.lang.Comparable<JulianDate>
public static final void main(java.lang.String[] astrArgs)