Date Functions - Gnorion/BizVR GitHub Wiki
Function | Example |
---|---|
addDays(date,days) |
addDays(date('2021/2/27'),4) returns date('2021/3/3') |
addMonths(date,months) |
addMonths(date('2021/2/27'),4) returns date('2021/6/27') |
addYears(date,years) |
addYears(date('2021/2/27'),4) returns date('2025/2/27') |
date(date) |
date('2024/1/1') returns the string as a date |
day(date) |
day(date('2021/2/27')) returns 27 |
dayOfWeek(date) | Sunday=1 |
dayOfMonth(date) |
dayOfMonth(date('2024/1/15')) returns 15 |
dayOfYear(date) |
dayOfYear(date('2021/12/31')) returns 365 |
daysInMonth(date) | `daysInMonth(date('2000/2/15'))' returns 29 |
getDays(date,date) |
getDays(date(2022/1/1'),date('2022/2/1')) returns 30 |
getMonths(date,date) |
getMonths(date(2022/1/1'),date('2022/3/1')) returns 2 |
getYears(date,date) |
getYear(date(2022/1/1'),date('2023/1/1')) returns 1 |
in [date..date] | |
isAfter(date,date) | |
isBefore(date,date) | |
isIN(date,date) | |
isOn(date,date) | |
isWeekend(date) |
isWeekend(date('2023/12/30')) returns true |
locale(date,loc) | |
milliseconds(date) | |
month(date) |
month(date('2023/12/30')) returns 12 |
monthName(date) |
monthName(date('2023/12/30')) returns 'December' |
monthsBetween(date,date) |
monthsBetween(date('2023/10/30'),date('2024/12/30')) returns 14 |
now() | returns the current date |
reformat(date,format) |
reformat(date('2024/1/1'),'YYY-MM-DD') returns 1/1/2024 |
tomorrow(date) |
tomorrow(date('2023/12/31')) returns 2024/1/1 |
year(date) |
year(date('2023/12/30')) returns 2023 |
yearsBetween(date,date) |
yearsBetween(date('2023/12/30'),date('2025/12/30')) returns 2 |
Not Implemented Yet | |
addBusinessDays(date,days,country) |
addBusinessdays(date('2022/7/1'),2,'US') returns date('2022/7/6') in the US |
isLeapYear(date) |
isLeapYear(date(2024/2/29') returns true |
isHoliday(date,country) |
isHoliday(date('2021/11/4'),'india') would return true since its Diwali |
holiday(date,country) |
holiday(date('2021/11/4'),'india') would return 'Diwali' |
weekOfMonth(date) |
weekOfMonth(date('2023/12/31')) returns 6 |
Is there value to accommodating other calendar systems by providing an optional parameter for those functions that might need it.
Function | Result |
---|---|
toCalendar(date('2021/9/13'),'Chinese') |
would return 'Eighth Month 7, 2021 (xin-chou), year of the Ox' |
toCalendar(date('2021/9/13').'Hebrew') |
would return '7 Tishri 5782' |
toCalendar(date('2021/9/13'),'Islamic') |
would return 'Safar 6, 1443 AH' |
toCalendar(date('Safar 6, 1443 AH'),'Gregorian') |
would return '2021/9/13' |
The function would return null if the conversion cannot be made