Package db2000.J.eXtrafunctions
Class fDATESTRING
- java.lang.Object
-
- db2000.J.eXtrafunctions.fDATESTRING
-
public class fDATESTRING extends Object
datestring functions
-
-
Constructor Summary
Constructors Constructor Description fDATESTRING()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringAddDaysToDate(String xDatestring, int xDays)returns the datestring on which have added daysstatic booleanAddEasterDayInHolidays(int xYear, boolean xAddEasterMonday)inserts easter days in holidays returns [true] if the upload was successful, otherwise [false]static StringAddMonthsToDate(String xDatestring, int xMonths)returns the datestring on which have added monthsstatic StringAddYearsToDate(String xDatestring, int xYears)returns the datestring on which have added yearsstatic intAge(String xBirthDatestring)returns the age (years) from the birthdatestatic intCountHolidaysFromDates(String xStartDatestring, String xEndDatestring)returns the number of holidays between two datestringstatic intCountWeekdayInMonth(int xWeekday, String xDatestring)returns the number of times the weekday of the monthstatic intCountWorkdaysFromDates(String xStartDatestring, String xEndDatestring, int xMode)returns the number of working days between two datestringstatic StringDateConversion(String xDateString, int xDateInputType, int xDateOutputType, String xSeparator)returns a datestring converted as requiredstatic longDateDiff(String xDatestring1, String xDatestring2, String xInterval, boolean xAbsoluteValue)returns a value corresponding to the number of time intervals between two datestringstatic StringDateFromYMD(int year, int month, int day)returns the datestring corresponding to the settings of the year, month and daystatic StringDateFromYMDHMS(int year, int month, int day, int hour, int minute, int second)returns the datestring corresponding to the settings of the year, month, day, hour, minute and secondstatic DateDatestringToDate(String xDateString)converts a datestring to a datestatic StringDateToDatestring(Date xDate)converts a date to a datestringstatic intDay(String xDatestring)returns the day of the monthstatic intDaysInMonth(int xYear, int xMonth)returns the days number of the monthstatic StringEasterDate(int xYear)returns the easter datestringstatic StringFindDateNextWeekday(int xWeekday, String xDatestring)returns the datestring found of the next weekdaystatic StringFindDatePreviousWeekday(int xWeekday, String xDatestring)returns the datestring found of the previous weekdaystatic StringFirstDateOfCurrentWeek()returns the datestring of the first day of the current weekstatic StringFirstDateOfMonth(String xDatestring)returns the datestring of the first day of the monthstatic StringFirstDateOfQuarter(String xDatestring)returns the datestring corresponding to the first day of a quarterstatic StringFirstDateOfWeek(String xDatestring)returns the datestring of the first day of the weekstatic StringFirstDateOfYearWeek(int xWeek, int xYear)returns the datestring on the first day of the 'n' year week (0-51)static StringFirstWorkdayNameOfMonth(String xDatestring, int xMode, boolean Shortname)returns the name of the first workday of the monthstatic StringFirstWorkdayOfMonth(String xDatestring, int xMode)returns the datestring of the first workday of the monthstatic StringGetDateFormat()returns the datestring format in use (default is "dd/MM/yyyy")static intGetFirstWeekday()returns the first weekday (1 = sunday *default*, 2 = monday, ..., 7 = saturday)static String[]GetHolidays()returns an string array containing all holidays allocated in memorystatic booleanInsertNewHolidayInMemory(int xMonth, int xDay)inserts a new holiday in memory (RAM) WARNING: not historicizes in external file returns [true] if the insert was successful, otherwise [false]static booleanIsDate(String xDatestring)returns [true] if the datestring is valid, otherwise [false]static booleanIsDatestring(String xDatestring)returns [true] if the datestring is valid, otherwise [false]static booleanIsHoliday(String xDatestring)returns [true] if the datestring is a holiday, otherwise [false]static booleanIsWeekend(String xDatestring)returns [true] if the datestring is a weekend, otherwise it returns [false]static StringLastDateOfMonth(String xDatestring)returns the datestring of the last day of the monthstatic StringLastDateOfQuarter(String xDatestring)returns the datestring corresponding to the last day of a quarterstatic StringLastDateOfWeek(String xDatestring)returns the datestring corresponding to the last day of the weekstatic intLastDayOfMonth(String xDatestring)returns the last day of the monthstatic StringLastWorkdayNameOfMonth(String xDatestring, int xMode, boolean Shortname)returns the name of the last workday of the monthstatic StringLastWorkdayOfMonth(String xDatestring, int xMode)returns the datestring of the last workday of the monthstatic booleanLoadHolidaysFromFile(String xFileName)loads the text file that contains the holidays, each line of text is a single holiday (use "MMDD" format) returns [true] if the upload was successful, otherwise [false]static intMonth(String xDatestring)returns the monthstatic StringMonthName(String xDatestring, boolean xShortname)returns the month namestatic StringNextAnniversary(String xDatestring)returns the datestring of the next anniversarystatic StringNextDate(String xDatestring)returns the next datestring (24 hours later), 'Null' is datestring not valid or errorstatic intNextDay(String xDatestring)returns the day nextstatic intNextMonth(String xDatestring)returns the next monthstatic StringNextMonthName(String xDatestring, boolean xShortname)returns the next month namestatic intNextWeekday(String xDatestring)returns the next weekday (1 = sunday, 2 = monday, ..., 7 = saturday)static StringNextWeekdayName(String xDatestring, boolean xShortname)returns the day name of the next weekdaystatic StringNextWorkday(String xDatestring, int xMode)returns the datestring of the next workdaystatic StringNextWorkdayName(String xDatestring, int xMode, boolean Shortname)returns the name of the next workdaystatic intNextYear(String xDatestring)returns the next yearstatic StringNow()returns the current datestatic StringNthWeekday(String xDatestring, int xNth, int xWeekday, boolean xMode)returns the datestring subsequent to the weekday setted for the number of recurrences specifiedstatic StringPreviousDate(String xDatestring)returns the previous datestring (24 hours before), 'Null' is datestring not valid or errorstatic intPreviousDay(String xDatestring)returns the previous daystatic intPreviousMonth(String xDatestring)returns the previous monthstatic StringPreviousMonthName(String xDatestring, boolean xShortname)returns the previous month namestatic intPreviousWeekday(String xDatestring)returns the previous weekday (1 = sunday, 2 = monday, ..., 7 = saturday)static StringPreviousWeekdayName(String xDatestring, boolean xShortname)returns the day name of the previous weekdaystatic StringPreviousWorkday(String xDatestring, int xMode)returns the datestring of the previous workdaystatic StringPreviousWorkdayName(String xDatestring, int xMode, boolean Shortname)returns the name of the previous workdaystatic intPreviousYear(String xDatestring)returns the previous yearstatic voidSetDateFormat(String xDateFormat)sets the datestring formatstatic voidSetFirstWeekday(int xWeekday)sets the first weekdaystatic StringSkipDateIfHolidays(String xDatestring, boolean xForward)returns the first datestring after the holidaysstatic StringSkipDateIfHolidaysOrWeekend(String xDatestring, boolean xForward)returns the first datestring after the holidays and/or weekendstatic StringSkipDateIfWeekend(String xDatestring, boolean xForward)returns the first datestring after the weekendstatic intWeekday(String xDatestring)returns the weekday (1 = sunday, 2 = monday, ..., 7 = saturday)static StringWeekdayName(String xDatestring, boolean xShortname)returns the day name of the weekstatic intYear(String xDatestring)returns the year
-
-
-
Method Detail
-
AddDaysToDate
public static String AddDaysToDate(String xDatestring, int xDays)
returns the datestring on which have added days- Parameters:
xDatestring- the datestring to which should be added the daysxDays- the number of days to add to the datestring
-
AddEasterDayInHolidays
public static boolean AddEasterDayInHolidays(int xYear, boolean xAddEasterMonday)inserts easter days in holidays returns [true] if the upload was successful, otherwise [false]
-
AddMonthsToDate
public static String AddMonthsToDate(String xDatestring, int xMonths)
returns the datestring on which have added months- Parameters:
xDatestring- the datestring to which should be added the monthsxMonths- the number of months to add to the datestring
-
AddYearsToDate
public static String AddYearsToDate(String xDatestring, int xYears)
returns the datestring on which have added years- Parameters:
xDatestring- the datestring to which should be added the yearsxYears- the number of years to add to the datestring
-
Age
public static int Age(String xBirthDatestring)
returns the age (years) from the birthdate
-
CountHolidaysFromDates
public static int CountHolidaysFromDates(String xStartDatestring, String xEndDatestring)
returns the number of holidays between two datestring- Parameters:
xStartDatestring- the start datestringxEndDatestring- the end datestring
-
CountWeekdayInMonth
public static int CountWeekdayInMonth(int xWeekday, String xDatestring)returns the number of times the weekday of the month- Parameters:
xWeekday- 1 = sunday, 2 = monday, ..., 7 = saturdayxDatestring- an datestring of the month
-
CountWorkdaysFromDates
public static int CountWorkdaysFromDates(String xStartDatestring, String xEndDatestring, int xMode)
returns the number of working days between two datestring- Parameters:
xStartDatestring- the start datestringxEndDatestring- the end datestringxMode- 0 = normal, 1 = keep holidays, 2 = keep weekends, 3 = keep holidays and weekends
-
DateDiff
public static long DateDiff(String xDatestring1, String xDatestring2, String xInterval, boolean xAbsoluteValue)
returns a value corresponding to the number of time intervals between two datestring- Parameters:
xDatestring1- the datestring 1xDatestring2- the datestring 2xInterval- "y" = years, "m" = months, "d" days, "h" = hours, "n" = minutes, "s" = seconds, "!" = millisecondsxAbsoluteValue- 'true' = absolute value, 'false' = none
-
DateFromYMD
public static String DateFromYMD(int year, int month, int day)
returns the datestring corresponding to the settings of the year, month and day
-
DateFromYMDHMS
public static String DateFromYMDHMS(int year, int month, int day, int hour, int minute, int second)
returns the datestring corresponding to the settings of the year, month, day, hour, minute and second
-
DateConversion
public static String DateConversion(String xDateString, int xDateInputType, int xDateOutputType, String xSeparator)
returns a datestring converted as required- Parameters:
xDatastring- the datestring to be convertedxDateInputType- the datestring format inputxDateOutputType- the datestring format outputxSeparator- the separator to be applied to the converted datestring the date format in input or output can be: 1 = "DD/MM/YYYY" 2 = "MM/DD/YYYY" 3 = "YYYY/MM/DD") 4 = "YYYY/DD/MM") 5 = "DD/YYYY/MM") 6 = "MM/YYYY/DD") 7 = "DDMMYYYY" 8 = "MMDDYYYY" 9 = "YYYYMMDD") 10 = "YYYYDDMM") 11 = "DDYYYYMM") 12 = "MMYYYYDD") returns the converted datestring
-
DatestringToDate
public static Date DatestringToDate(String xDateString)
converts a datestring to a date- Parameters:
xDateString- the datestring to be converted returns the date, 'Null' is datestring not valid or error
-
DateToDatestring
public static String DateToDatestring(Date xDate)
converts a date to a datestring- Parameters:
xDate- the date to be converted returns the date in string format, 'Null' is date not valid or error
-
Day
public static int Day(String xDatestring)
returns the day of the month
-
DaysInMonth
public static int DaysInMonth(int xYear, int xMonth)returns the days number of the month
-
EasterDate
public static String EasterDate(int xYear)
returns the easter datestring
-
FindDateNextWeekday
public static String FindDateNextWeekday(int xWeekday, String xDatestring)
returns the datestring found of the next weekday- Parameters:
xWeekday- the day of week (1 = sunday, 2 = monday, ..., 7 = saturday)xDatestring- the datestring from which to search
-
FindDatePreviousWeekday
public static String FindDatePreviousWeekday(int xWeekday, String xDatestring)
returns the datestring found of the previous weekday- Parameters:
xWeekday- the day of week (1 = sunday, 2 = monday, ..., 7 = saturday)xDatestring- the datestring from which to search
-
FirstDateOfMonth
public static String FirstDateOfMonth(String xDatestring)
returns the datestring of the first day of the month
-
FirstDateOfQuarter
public static String FirstDateOfQuarter(String xDatestring)
returns the datestring corresponding to the first day of a quarter
-
FirstDateOfWeek
public static String FirstDateOfWeek(String xDatestring)
returns the datestring of the first day of the week
-
FirstDateOfYearWeek
public static String FirstDateOfYearWeek(int xWeek, int xYear)
returns the datestring on the first day of the 'n' year week (0-51)
-
FirstDateOfCurrentWeek
public static String FirstDateOfCurrentWeek()
returns the datestring of the first day of the current week
-
FirstWorkdayOfMonth
public static String FirstWorkdayOfMonth(String xDatestring, int xMode)
returns the datestring of the first workday of the month- Parameters:
xDatestring- the start datestringxMode- = 0 skip holidays, = 1 skip weekends, = 2 skip holidays and weekends
-
FirstWorkdayNameOfMonth
public static String FirstWorkdayNameOfMonth(String xDatestring, int xMode, boolean Shortname)
returns the name of the first workday of the month- Parameters:
xDatestring- the start datestringxMode- = 0 skip holidays, = 1 skip weekends, = 2 skip holidays and weekends
-
GetDateFormat
public static String GetDateFormat()
returns the datestring format in use (default is "dd/MM/yyyy")
-
GetFirstWeekday
public static int GetFirstWeekday()
returns the first weekday (1 = sunday *default*, 2 = monday, ..., 7 = saturday)
-
GetHolidays
public static String[] GetHolidays()
returns an string array containing all holidays allocated in memory
-
InsertNewHolidayInMemory
public static boolean InsertNewHolidayInMemory(int xMonth, int xDay)inserts a new holiday in memory (RAM) WARNING: not historicizes in external file returns [true] if the insert was successful, otherwise [false]
-
IsDate
public static boolean IsDate(String xDatestring)
returns [true] if the datestring is valid, otherwise [false]- Parameters:
xDatestring- the datestring to be checked
-
IsDatestring
public static boolean IsDatestring(String xDatestring)
returns [true] if the datestring is valid, otherwise [false]- Parameters:
xDateString- the datestring to be checked
-
IsHoliday
public static boolean IsHoliday(String xDatestring)
returns [true] if the datestring is a holiday, otherwise [false]
-
IsWeekend
public static boolean IsWeekend(String xDatestring)
returns [true] if the datestring is a weekend, otherwise it returns [false]
-
LastDateOfMonth
public static String LastDateOfMonth(String xDatestring)
returns the datestring of the last day of the month
-
LastDateOfQuarter
public static String LastDateOfQuarter(String xDatestring)
returns the datestring corresponding to the last day of a quarter
-
LastDateOfWeek
public static String LastDateOfWeek(String xDatestring)
returns the datestring corresponding to the last day of the week
-
LastDayOfMonth
public static int LastDayOfMonth(String xDatestring)
returns the last day of the month
-
LastWorkdayOfMonth
public static String LastWorkdayOfMonth(String xDatestring, int xMode)
returns the datestring of the last workday of the month- Parameters:
xDatestring- the start datestringxMode- = 0 skip holidays, = 1 skip weekends, = 2 skip holidays and weekends
-
LastWorkdayNameOfMonth
public static String LastWorkdayNameOfMonth(String xDatestring, int xMode, boolean Shortname)
returns the name of the last workday of the month- Parameters:
xDatestring- the start datestringxMode- = 0 skip holidays, = 1 skip weekends, = 2 skip holidays and weekends
-
LoadHolidaysFromFile
public static boolean LoadHolidaysFromFile(String xFileName)
loads the text file that contains the holidays, each line of text is a single holiday (use "MMDD" format) returns [true] if the upload was successful, otherwise [false]
-
Month
public static int Month(String xDatestring)
returns the month
-
MonthName
public static String MonthName(String xDatestring, boolean xShortname)
returns the month name
-
NextAnniversary
public static String NextAnniversary(String xDatestring)
returns the datestring of the next anniversary
-
NextDate
public static String NextDate(String xDatestring)
returns the next datestring (24 hours later), 'Null' is datestring not valid or error
-
NextDay
public static int NextDay(String xDatestring)
returns the day next
-
NextMonth
public static int NextMonth(String xDatestring)
returns the next month
-
NextMonthName
public static String NextMonthName(String xDatestring, boolean xShortname)
returns the next month name
-
NextWeekday
public static int NextWeekday(String xDatestring)
returns the next weekday (1 = sunday, 2 = monday, ..., 7 = saturday)
-
NextWeekdayName
public static String NextWeekdayName(String xDatestring, boolean xShortname)
returns the day name of the next weekday
-
NextWorkday
public static String NextWorkday(String xDatestring, int xMode)
returns the datestring of the next workday- Parameters:
xDatestring- the start datestringxMode- = 0 skip holidays, = 1 skip weekends, = 2 skip holidays and weekends
-
NextWorkdayName
public static String NextWorkdayName(String xDatestring, int xMode, boolean Shortname)
returns the name of the next workday- Parameters:
xDatestring- the start datestringxMode- = 0 skip holidays, = 1 skip weekends, = 2 skip holidays and weekends
-
NextYear
public static int NextYear(String xDatestring)
returns the next year
-
Now
public static String Now()
returns the current date
-
NthWeekday
public static String NthWeekday(String xDatestring, int xNth, int xWeekday, boolean xMode)
returns the datestring subsequent to the weekday setted for the number of recurrences specified- Parameters:
xDatestring- the start datestringxNth- the number of recurrencesxWeekday- the weekday (1 = sunday, 2 = monday, ..., 7 = saturday)xMode- [false] = starts from the day specified in the datestring, [true] = starts from the first day of the month shown in the datestring
-
PreviousDate
public static String PreviousDate(String xDatestring)
returns the previous datestring (24 hours before), 'Null' is datestring not valid or error
-
PreviousDay
public static int PreviousDay(String xDatestring)
returns the previous day
-
PreviousMonth
public static int PreviousMonth(String xDatestring)
returns the previous month
-
PreviousMonthName
public static String PreviousMonthName(String xDatestring, boolean xShortname)
returns the previous month name
-
PreviousWeekday
public static int PreviousWeekday(String xDatestring)
returns the previous weekday (1 = sunday, 2 = monday, ..., 7 = saturday)
-
PreviousWeekdayName
public static String PreviousWeekdayName(String xDatestring, boolean xShortname)
returns the day name of the previous weekday
-
PreviousWorkday
public static String PreviousWorkday(String xDatestring, int xMode)
returns the datestring of the previous workday- Parameters:
xDatestring- the start datestringxMode- = 0 skip holidays, = 1 skip weekends, = 2 skip holidays and weekends
-
PreviousWorkdayName
public static String PreviousWorkdayName(String xDatestring, int xMode, boolean Shortname)
returns the name of the previous workday- Parameters:
xDatestring- the start datestringxMode- = 0 skip holidays, = 1 skip weekends, = 2 skip holidays and weekends
-
PreviousYear
public static int PreviousYear(String xDatestring)
returns the previous year
-
SetDateFormat
public static void SetDateFormat(String xDateFormat)
sets the datestring format- Parameters:
xDateFormat- the datestring format
-
SetFirstWeekday
public static void SetFirstWeekday(int xWeekday)
sets the first weekday- Parameters:
xWeekday- the weekday (1 = sunday , 2 = monday, ..., 7 = saturday)
-
SkipDateIfHolidays
public static String SkipDateIfHolidays(String xDatestring, boolean xForward)
returns the first datestring after the holidays
-
SkipDateIfHolidaysOrWeekend
public static String SkipDateIfHolidaysOrWeekend(String xDatestring, boolean xForward)
returns the first datestring after the holidays and/or weekend
-
SkipDateIfWeekend
public static String SkipDateIfWeekend(String xDatestring, boolean xForward)
returns the first datestring after the weekend
-
Weekday
public static int Weekday(String xDatestring)
returns the weekday (1 = sunday, 2 = monday, ..., 7 = saturday)
-
WeekdayName
public static String WeekdayName(String xDatestring, boolean xShortname)
returns the day name of the week
-
Year
public static int Year(String xDatestring)
returns the year
-
-