cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ahockaday
Level: Powered On

Set Default date of Date Picker to first and last day of that Month

I have 2 date pickers on my app that I am using to filter the content. Is there a way to set the default date of the date pickers so the first one defaults to the first day of that days month and the second date picker to default to the last day of the month based on today. Currently I am setting the first date pickers default date to Today()-21 and the second to Today()+7, so it shows me kind of a rolling 30 days but not really a month view where it is for the particular month where since today is June 12, it is setting the default date in date picker one to June 1 and the default date in date picker 2 to June 30.  

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Set Default date of Date Picker to first and last day of that Month

You can set the first date picker DefaultDate property to:

Date(Year(Today()), Month(Today()), 1)

And the second one to:

Date(Year(Today()), Month(Today()) + 1, 0)

or

DateAdd(
    DateAdd(
        Date(Year(Today()), Month(Today()), 1),
        1,
        Months),
    -1,
    Days)
2 REPLIES 2
Highlighted
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Set Default date of Date Picker to first and last day of that Month

You can set the first date picker DefaultDate property to:

Date(Year(Today()), Month(Today()), 1)

And the second one to:

Date(Year(Today()), Month(Today()) + 1, 0)

or

DateAdd(
    DateAdd(
        Date(Year(Today()), Month(Today()), 1),
        1,
        Months),
    -1,
    Days)
ahockaday
Level: Powered On

Re: Set Default date of Date Picker to first and last day of that Month

thanks a lot. That works perfectly.