Get start and last date of month using Power Apps

In a previous post, we looked at how to get first date and last date of a month using expressions in Power Automate. 

In this post, we are going to look at how we can get the same information in Power Apps.

Here, we have used Today() to get the dates based on current date, however it can be made even more dynamic by using DatePicker and replacing Today() with DatePicker1.SelectedDate

All dates calculated in this post are in the US format: MM-DD-YYYY

First Day of Month

DateValue(Month(Today()) & "/" & "1" & "/" & Year(Today()))


First Day of Next Month

In this step, we add 1 month to the first day of the current month

DateAdd(

    DateValue (Month(Today()) & "/" & "1" & "/" & Year(Today())),

    1,

    Months

)


Last Day of Month

In this step, we subtract 1 day from the first day of the next month

DateAdd(
    DateAdd(
        DateValue (Month(Today()) & "/" & "1" & "/" & Year(Today())),
        1,
        Months
    ),
    -1,
    Days
)


Comments

Popular posts from this blog

Generate QR code within Power Automate

Restrict Attachment control in PowerApps to accept Excel files only