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.
3 REPLIES 3
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.
batmanMon
Level: Powered On

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

 @v-xida-msft   It works purrrffffeeeeccct. Thanks for sharing

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

Follow PowerApps on Twitter

Stay Up-to-Date by following PowerApps on Twitter

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

Users Online
Currently online: 55 members 4,304 guests
Please welcome our newest community members: