Calculate Total number of days in a month
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
Solved! Go to Solution.
- Labels:
- Common Use Cases
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hey @hemant86 , do you have year information as well as no. of days in February varies in leap year.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks @DavidSkaife . This woks great for me. Appreciate your help😊
