web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to clear a datepic...
Power Apps
Answered

How to clear a datepicker (leaving it blank)

(1) ShareShare
ReportReport
Posted on by 96

I created an powerapp with a datepicker. The datepicker should show default the date of today. I created a clear button. I would like to make the datepicker empty when I click on this clear button. The datepicker should be blank. How to do this?

 

datepicker clear button.png

Categories:
I have the same question (0)
  • eka24 Profile Picture
    20,923 on at

    Once you make the default Today, it cannot be Blank at the same time. 

    To work around it, insert a button and Onselect set a variable;

    UpdateContext ({MakeBlank:! MakeBlank)})

     

    Then put in the defaultdate;

    If(MakeBlank,Today(), Blank ())

     

    So when you click the button it can change from Today to blank and vice versa

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • dreamsat Profile Picture
    96 on at

    Do I need to create a variable with the name "MakeBlank" somewhere?

  • eka24 Profile Picture
    20,923 on at

    Yes I stated that in the reply, recheck

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

     

  • dreamsat Profile Picture
    96 on at

    I see it. There was a small type. It should be: UpdateContext ({MakeBlank:! MakeBlank})

  • dreamsat Profile Picture
    96 on at

    When I click on the clear button the first time it is doing what I expect. But when I click again on the clear button it sets the date of today. How can I avoid this behavior after the second click?

  • mdevaney Profile Picture
    29,989 Moderator on at

    @dreamsat 
    Use this code in the OnSelect property of your button.

    Set(showBlankDate, true)

     

    Then use this code in the Default property of the DatePicker.

    If(showBlankDate, Blank(), Today())

     

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

     

  • Verified answer
    eka24 Profile Picture
    20,923 on at

    In that case use two buttons, one for Blank and the other for Today.

     

    Blank Button

    UpdateContext ({MakeBlank:false)})

     

    Today button;

    UpdateContext ({MakeBlank:true)})

     

    Maintain the formula on the DatePicker

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • dreamsat Profile Picture
    96 on at

    Great, it works!

  • harioachira Profile Picture
    23 on at

    First , set the defaultDate to blank

    harioachira_0-1654494368822.png

    Then add the below simple code on the "OnSelect" event to the clear button

    Reset(Datepickername)

     

     

     

  • sonam1996sahoo Profile Picture
    143 on at

    Hi, @mdevaney 

    I followed your solution. It reset and display the blank value while I inserted the date for the first time. But the second time, it neither reset nor show a blank value...😶

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard