🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

How to calculate no of day's present in month based on given date

User: "sgnarkhede2016"
New Altair Community Member
Updated by Jocelyn
I have the requirement of finding a total number of days in a month based on date. For e.g I have a date with me i.e. 15 April 2021 then a number of days must return 30 as April month consists of 30 days. If I have a date of 02 Feb 2020 then the number of days should return as 29 as it is a leap year.

Can we achieve this in RapidMiner using any in-built function or operator?

Find more posts tagged with

Sort by:
1 - 3 of 31
    well, isnt this just joining the days and taking care of february?

    Best,
    Martin
    User: "Caperez"
    Altair Community Member
    Accepted Answer
    Hi @sgnarkhede2016,

    You can use the pandas.Period.days_in_month method in a python script. operator.
    p = pd.Period('2021-4-21')
    p.days_in_month
    return 30. 

    please find attached an example process 
    User: "Telcontar120"
    New Altair Community Member
    Accepted Answer
    If you don't want to use python you can also extract the month from the date (using Generate Attributes) and then a lookup table to join the number of days based on the month.