Skip to content

Date Actions

Date Actions are actions to interact with date in Marvin.

Date Mask

To interact with dates it should be defined a mask.

%Y: Year with four digits, ex: 2020.

%m: Month with two digits, ex: 01.

%d: Day with two digits, ex: 05.

Considering the day 2020-05-30, using the mask we can get the following exits:

%Y/%m/%d: 2020/05/30

%d-%m-%Y: 30-05-2020

%Y%m: 202005

Actions

date.convert_date_format

Convert date format to another format as desired.

Parameters:

date_str - date as text in the current format. This is the input for the convertion.

input_mask (optional) - mask of the input text date (default=%Y-%m-%d).

output_mask (optional) - mask of the output text date (default=%Y-%m-%d).

Return:

date - text date with the given mask

date.delta_business_days

Return a date considering how many business days before or aft. If you need past days, use negative numbers, if you need future days, use positive numbers.

Parameters:

date (optional) - base date to calculate the business days delta (default=today).

days (optional) - how many business days should be added or subtracted from the base date. Positive numbers will give future business days, and negative numbers past business days.

mask (optional) - mask of the output text date (default=%Y-%m-%d).

Return:

date - text date with the given mask

date.delta_days

Return a new text dat considering the desired interval.

Parameters:

date (optional) - base date to calculate the business days delta (default=today).

years (optional) - how many years should be added or subtracted from the base date. Positive numbers will give future dates, and negative numbers past dates (default=0).

months (optional) - how many months should be added or subtracted from the base date. Positive numbers will give future dates, and negative numbers past dates (default=0).

days (optional) - how many days should be added or subtracted from the base date. Positive numbers will give future dates, and negative numbers past dates (default=0).

mask (optional) - mask of the output text date (default=%Y-%m-%d).

Return:

date - text date with the given mask

date.first_day_of_month

Return the first day of the month for the given month and year. If no month and year were given, it will use today as default year/month.

Important: year and month must be informed to consider as a valid input. If one of those params are not set, today will be used as dafault year/month.

Parameters:

years (optional) - mumber of the year to return the first day

months (optional) - number of the month to return the first day

mask (optional) - mask of the output text date (default=%Y-%m-%d).

Return:

date - text date with the given mask

date.last_day_of_month

Return the last day of the month for the given month and year. If no month and year were given, it will use today as default year/month.

Important: year and month must be informed to consider as a valid input. If one of those params are not set, today will be used as dafault year/month.

Parameters:

years (optional) - mumber of the year to return the first day

months (optional) - number of the month to return the first day

mask (optional) - mask of the output text date (default=%Y-%m-%d).

Return:

date - text date with the given mask

date.today

Return a new text date as today

Parameters:

mask (optional) - mask of the output text date (default=%Y-%m-%d).

Return:

date - text date with today date in the given mask