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

How to set a DatePicker control to start of last Month

I can set a Date Picker to be the first day of the Month by using the following:

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

 

How do you set a Date Picker to be the first day of the previous month?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: How to set a DatePicker control to start of last Month

Hi @paul_raymond,

Do you want to set a DatePicker control to the first day of previous month?

I have made a test on my side, please take a try with the following workaround:3.JPG

Set the DefaultDate proeprty of the DatePicker control to following:

Date(
Year(DateAdd(Today(),-1,Months)),
Month(DateAdd(Today(),-1,Months)),
1
)

More details about the DateAdd function in PowerApps, please check the following article:

DateAdd function

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 REPLIES 2
strategery
Level 8

Re: How to set a DatePicker control to start of last Month

DateAdd in combination with what you have should work:

DateAdd( Date(Year(Today()), Month(Today()), 1 ), -1, Months )

 

Check here for more info:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-dateadd-datediff

Community Support Team
Community Support Team

Re: How to set a DatePicker control to start of last Month

Hi @paul_raymond,

Do you want to set a DatePicker control to the first day of previous month?

I have made a test on my side, please take a try with the following workaround:3.JPG

Set the DefaultDate proeprty of the DatePicker control to following:

Date(
Year(DateAdd(Today(),-1,Months)),
Month(DateAdd(Today(),-1,Months)),
1
)

More details about the DateAdd function in PowerApps, please check the following article:

DateAdd function

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.