2

Hi, Does anyone know how to calculate total day in a month? The value will always change follow to the current date month. For example April has 30 days, May has 31 days. I want to used the value in microflow as condition. Thanks

asked

Muhammad Ikhwan Afiq bin Azmir

4 answers

3

How about skipping the calculations altogether and just use:

`formatDateTime([%EndOfCurrentMonth%], 'd')`

If you want the integer, wrap it in a parseInteger function.

answered

Martin Koelewijn

1

Using this expression, can get the current month’s total number of days:

ceil(daysBetween([%BeginOfCurrentMonth%],[%EndOfCurrentMonth%]))

answered

Krishna Veni P

0

This is a very simple logic. It is always same for all months for any Year except for February in Leap Years.

So assuming you have Month and Year as input to a microflow, there,

if the month is

Jan then 31 days

Feb is 29 days is Leap Year else 28 days,

March is 31,

April is 30

May is 31

June is 30

July is 31

August is 31

September 30

October 31

November 30

December 31

answered

Ganesh Acharya

0

Using the * daysBetween()* function along with other date functions this can be achieved.

An example of how you could do this.

`daysBetween(trimToMonths([%CurrentDateTime%]),addDays(trimToDays(addDays([%EndOfCurrentMonth%],1)),-1))`

You could then vary the [%CurrentDateTime%] and [%EndOfCurrentMonth%] and make them custome parameters that you pass into a microflow.

`daysBetween(trimToMonths($DateParameterOne),addDays(trimToDays(addDays($DateParameterTwo,1)),-1))`

Alternatively you could use the dateTime functions with the daysBetween function:

`daysBetween(dateTime(2007, 2, 13, 1, 1, 1), dateTime(2007,1,1,1,1,1))`

answered

Brent Eichstadt