Calculating # of days in a given month

I previously asked this question, but the snippet is no longer working.

I would like to calculate number of days in a given month based off of a date and also number of days for the next month.

Example:
Input 10/23/2023

Outcome:
October = 31
November = 30

Help! And thank you in advance. :slight_smile:

@Stephanie_Bouldin great question, I was just working on something similar to this for another customer... this will do what you need it to do:

{formdate: YYYY-MM-DD; name=starting}

Days Selected Month: {time: D; at={=starting}; shift=>M}

Days Following Month: {time: D; at={=starting}; shift=+1M >M}

If you need the results to be usable in another equation, like for totaling those number of days up easily, you can save the results as variables to use:

{formdate: YYYY-MM-DD; name=starting}

Days Selected Month: {current={time: D; at={=starting}; shift=>M}}{=current}

Days Following Month: {next={time: D; at={=starting}; shift=+1M >M} }{=next}

Total number of days between the two months: {=current+next}

1 Like

Thanks so much @Andrew_Hall !!!!