Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Calculate Total number of days in a month

hemant86
11 - Bolide

Hi Team,

 

I need to calculate total number of days in a month but thing is I do not have a date but I have the month name of number. For example "September" or 9.

Can we calculate total number of days in the month by only using month name or number.

 

Appreciate any help around this.

 

Thanks in Advance.

4 REPLIES 4
ATelore
5 - Atom

Hey @hemant86 , do you have year information as well as no. of days in February varies in leap year.

hemant86
11 - Bolide

Thanks @ATelore. for your response. I do not have year info but we can always take current year I guess. I am taking the input from user which will always be month name.

DavidSkaife
13 - Pulsar

Hi @hemant86 

 

If the month is in a numerical format try using this

 

DateTimeFormat(DateTimeTrim(DateTimeParse(ToString([Month]),'%m'),'lastofmonth'),'%d')

 

If its in month name format try this

 

DateTimeFormat(DateTimeTrim(DateTimeParse([Month],"%b"),'lastofmonth'),'%d')

 

This is a bit of a cheaty way but as you're going to default to the current year, this will give you the last day of the month for the given month and hence the number of days for that month

 

Capture.PNG

hemant86
11 - Bolide

Thanks @DavidSkaife . This woks great for me. Appreciate your help😊 

Labels