{Solved} How to clear a DatePicker control in Canvas apps

Hello everyone and welcome to my blog. In today’s blog, I will show how you can clear a DatePicker control in PowerApps.

You might be wondering why can’t I simply set it to Blank()? Well, that is what you need to do. Let’s see what happens when I set the DefaultDate property of the DatePicker control to Blank().

I have a DatePicker control in my app. Currently it is showing today’s date as the Default Date.

Now I want to show a blank value in DatePicker control. My first hunch is to set the DefaultDate property of the DatePicker control to Blank(). Let’s see what happens when we do this.

I have set the DefaultDate property to Blank().

But the control does not clear. Instead it shows the date value – 31st of December, 2001.

But why is that so? What is so special about this date? This is because of the another property of the DatePicker control – InputTextPlaceholder.

Let’s look at the formula of InputTextPlaceholder property of the DatePicker control

Well, now you understand why it is 31st of December, 2001.

I set the property to Blank(). So that takes care of the placeholder text value.

Now the final thing, to tie all this up, I have created a button – ‘Clear Date‘ which would clear the date value from the DatePicker control.

In the ‘OnSelect‘ of the button, I reset the DatePicker control using the Reset function.

Remember – The Reset function will reset the DatePicker field value to the value you have set in the DefaultDate property of the DatePicker control. If you have set it to Blank(), it will clear. However if your intention is to set to today’s date for example, you need to set the property to Today().

Check out below to see the final thing in action.

Hope this helped.

Debajit Dutta


Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe to get the latest posts sent to your email.

Leave a Comment

Your email address will not be published. Required fields are marked *

Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading