RPA.Calendar
Add a day or list of days which are considered as holidays in addition to country specific holidays when calculating
Arguments
Argument | Type | Default value |
---|---|---|
days | str, date, DateTime, List[str | date | DateTime] | null |
param days: | string or list of dates to consider as holidays |
---|---|
return: | list of current custom holidays |
Python example.
Robot Framework example.
Compares given times and returns True if time2 is more recent than time1.
Arguments
Argument | Type | Default value |
---|---|---|
time1 | str, date, DateTime | null |
time2 | str, date, DateTime | null |
param time1: | first time for comparison |
---|---|
param time2: | second time for comparison |
return: | True if time2 is more recent than time1 |
Python example.
Robot Framework example.
Compares given times and returns True if time2 is more recent than time1.
param time1: | first time for comparison |
---|---|
param time2: | second time for comparison |
return: | True if time2 is more recent than time1 |
Robot Framework example.
Compares given times and returns True if time1 is more recent than time2.
param time1: | first time for comparison |
---|---|
param time2: | second time for comparison |
return: | True if time1 is more recent than time2 |
Robot Framework example.
This keyword tries to construct valid calendar instance from given date string and its expected date format.
Arguments
Argument | Type | Default value |
---|---|---|
date_string | str | null |
date_format_in | str, None | None |
timezone | str, None | None |
date_format_out | str, None | None |
See https://pendulum.eustace.io/docs/#tokens for valid tokens for the date format. Tokens are used to form correct date and time format.
param date_string: | for example. "22 May 19" |
---|---|
param date_format_in: | for example. "DD MMM YY" |
param timezone: | default timezone is "UTC" |
param date_format_out: | for example. "DD-MM-YY" |
return: | set datetime as an object or string if date_format_out has been set |
Python example.
Robot Framework example.
Return first business day of the month.
Arguments
Argument | Type | Default value |
---|---|---|
date | str, date, DateTime | null |
country | str, None | None |
If country is not given then holidays are not considered.
param date: | date describing the month |
---|---|
param country: | country code, default None |
return: | first business of the month |
Python example.
Robot Framework example.
Get ISO calendar information for the given date.
Arguments
Argument | Type | Default value |
---|---|---|
date | str, date, DateTime | null |
parameter date: | input date |
---|---|
return: | ISO calendar object containing year, week number and weekday. |
Python example.
Robot Framework example.
Is the date a business day in a country.
param date_in: | input date |
---|---|
param country: | country code |
return: | True if the day is a business day, False if not |
Robot Framework example.
Is the date a holiday in a country.
param date_in: | input date |
---|---|
param country: | country code |
return: | True if the day is a holiday, False if not |
Robot Framework example.
Is the date a business day in a country.
Arguments
Argument | Type | Default value |
---|---|---|
date | str, date, DateTime | null |
country | str, None | None |
If country is not given then holidays are not considered.
param date: | input date |
---|---|
param country: | country code, default None |
return: | True if the day is a business day, False if not |
Python example.
Robot Framework example.
Is the date a holiday in a country. If country is not given then checks only if date is in custom holiday list.
Arguments
Argument | Type | Default value |
---|---|---|
date | str, date, DateTime | null |
country | str, None | None |
param date_in: | input date |
---|---|
param country: | country code, default None |
return: | True if the day is a holiday, False if not |
Python example.
Robot Framework example.
Return last business day of the month.
Arguments
Argument | Type | Default value |
---|---|---|
date | str, date, DateTime | null |
country | str, None | None |
If country is not given then holidays are not considered.
param date: | date describing the month |
---|---|
param country: | country code, default None |
return: | last business day of the month |
Python example.
Robot Framework example.
Reset custom holiday list into empty list.
Return holidays for a country. If country is not given then only custom holidays are returned.
Arguments
Argument | Type | Default value |
---|---|---|
years | int, List[int] | null |
country | str, None | None |
param years: | single year or list of years to list holidays for |
---|---|
param country: | country code, default None |
return: | holidays in a dictionary, the key is the date and the value is name of the holiday |
Python example.
Robot Framework example.
Return the next business day.
Arguments
Argument | Type | Default value |
---|---|---|
date | str, date, DateTime | null |
country | str, None | None |
return_format | str | YYYY-MM-DD |
locale | str, None | None |
param date: | day of origin |
---|---|
param country: | country code, default None |
param return_format: | dates can be formatted for the resulting list, defaults to "YYYY-MM-DD" |
param locale: | name of the locale |
return: | the next business day from day of origin |
Python example.
Robot Framework example.
Return the previous business day.
Arguments
Argument | Type | Default value |
---|---|---|
date | str, date, DateTime | null |
country | str, None | None |
return_format | str | YYYY-MM-DD |
locale | str, None | None |
param date: | day of origin |
---|---|
param country: | country code, default None |
param return_format: | dates can be formatted for the resulting list, defaults to "YYYY-MM-DD" |
param locale: | name of the locale |
return: | the previous business day from day of origin |
Python example.
Robot Framework example.
Set weekdays which are considered as business days for calculating previous and next business day.
Arguments
Argument | Type | Default value |
---|---|---|
days | List[int] | null |
param days: | list of integers denoting weekdays |
---|---|
return: | previous list of weekdays |
Python example.
Robot Framework example.
Set locale globally for the library
Arguments
Argument | Type | Default value |
---|---|---|
locale_name | str | null |
param locale_name: | name of the locale |
---|---|
return: | name of the previous locale |
Python example.
Robot Framework example.
Sort list of dates.
Arguments
Argument | Type | Default value |
---|---|---|
dates | List[str | date | DateTime] | null |
return_format | str, None | None |
reverse | bool | False |
param dates: | list of dates to sort |
---|---|
param return_format: | dates can be formatted for the resulting list |
param reverse: | True return latest to oldest, defaults to False, which means order from oldest to latest |
return: | list of sorted dates |
Python example.
Robot Framework example.
Compare 2 dates and get the time difference.
Arguments
Argument | Type | Default value |
---|---|---|
start_date | str, date, DateTime | null |
end_date | str, date, DateTime | null |
start_timezone | str, None | None |
end_timezone | str, None | None |
Returned dictionary contains following properties:
- end_date_is_later, True if end_date is more recent than start_date, otherwise False
- years, time difference in years
- months, time difference in months
- days, time difference in days
- hours, time difference in hours (in addition to the days)
- minutes, time difference in minutes (in addition to the hours)
- seconds, time difference in seconds (in addition to the minutes)
param start_date: | starting date for the comparison |
---|---|
param end_date: | ending date for the comparison |
param start_timezone: | timezone for the starting date, defaults to None |
param end_timezone: | timezone for the ending date, defaults to None |
return: | dictionary containing comparison result |
Python example.
Robot Framework example.
Return the hour difference between timezones.
Arguments
Argument | Type | Default value |
---|---|---|
start_timezone | str | null |
end_timezone | str | null |
param start_timezone: | first timezone |
---|---|
param end_timezone: | second timezone |
return: | hour difference between the timezones |
Python example.
Robot Framework example.
Return the time difference of dates in days.
Arguments
Argument | Type | Default value |
---|---|---|
start_date | str, date, DateTime | null |
end_date | str, date, DateTime | null |
start_timezone | str, None | None |
end_timezone | str, None | None |
param start_date: | the start date |
---|---|
param end_date: | the end date |
param start_timezone: | timezone for the start date, defaults to None |
param end_timezone: | timezone for the end date, defaults to None |
return: | difference in days |
Python example.
Robot Framework example.
Return the time difference of dates in hours.
Arguments
Argument | Type | Default value |
---|---|---|
start_date | str, date, DateTime | null |
end_date | str, date, DateTime | null |
start_timezone | str, None | None |
end_timezone | str, None | None |
param start_date: | the start date |
---|---|
param end_date: | the end date |
param start_timezone: | timezone for the start date, defaults to None |
param end_timezone: | timezone for the end date, defaults to None |
return: | difference in hours |
Python example.
Robot Framework example.
Return the time difference of dates in minutes.
Arguments
Argument | Type | Default value |
---|---|---|
start_date | str, date, DateTime | null |
end_date | str, date, DateTime | null |
start_timezone | str, None | None |
end_timezone | str, None | None |
param start_date: | the start date |
---|---|
param end_date: | the end date |
param start_timezone: | timezone for the start date, defaults to None |
param end_timezone: | timezone for the end date, defaults to None |
return: | difference in minutes |
Python example.
Robot Framework example.
Return time difference of dates in months.
Arguments
Argument | Type | Default value |
---|---|---|
start_date | str, date, DateTime | null |
end_date | str, date, DateTime | null |
start_timezone | str, None | None |
end_timezone | str, None | None |
param start_date: | the start date |
---|---|
param end_date: | the end date |
param start_timezone: | timezone for the start date, defaults to None |
param end_timezone: | timezone for the end date, defaults to None |
return: | difference in months |
Python example.
Robot Framework example.
Return current date and time
Arguments
Argument | Type | Default value |
---|---|---|
timezone | str, None | None |
return_format | str | YYYY-MM-DD |
param timezone: | optional, for example. "America/Boston" |
---|---|
param return_format: | dates can be formatted for the resulting list, defaults to "YYYY-MM-DD" |
return: | current datetime as an object |
Python example.
Robot Framework example.