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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Update Date picker to ...
Power Apps
Answered

Update Date picker to current date if the date field is blank

(0) ShareShare
ReportReport
Posted on by

I have a date field in the NewForm view that will serve as the date the form was submitted. I want this date field to be autopopulated to the current date and not change after the form is submitted. My logic is when the newform view opens and if the date field is blank, then set the date to Today(). I have the following formula as the DefaultDate:
If(IsBlank(ThisItem.Date),Today())
This appears to work in the PowerApps Preview and when I publish and play the app via a web browser but when I try to test the app on a device, the date is not populating to the current date. What am I missing?

Categories:
I have the same question (0)
  • tchin-nin Profile Picture
    779 on at

    Hi @PowerAid,

     

    By doing so you're only populated the datefield when this one is blank. 

    You should try playing with the FormMode like this :

    DatePicker.DefaultDate : If(Form1.FormMode=New,Today(),ThisItem.Date)

    Theo

  • PowerAid Profile Picture
    on at

    @tchin-nin wrote:

    Hi @PowerAid,

     

    By doing so you're only populated the datefield when this one is blank. 

    You should try playing with the FormMode like this :

    DatePicker.DefaultDate : If(Form1.FormMode=New,Today(),ThisItem.Date)

    Theo


    Hi Theo,

     

    In regard to your suggestion, I don't understand where and what to type.  Do I select the date field, then select the DefaultDate property dropdown and then type the following?

    If(Form1.FormMode=New,Today(),ThisItem.Date

     

  • tchin-nin Profile Picture
    779 on at

    Yes exactly, you set this formula on the DefaultDate property of your datepicker control.

    The formula says, if the form is a new item form, then set the date to Today(). If not (so if it is an Edit or a View form) set the date to the current item date (which will be the date saved when the item has been created). 

     

    If you don't want your users to change that date you can just hide the DataCard by setting the Visibile property to : false. 

     

    Théo

  • PowerAid Profile Picture
    on at

    @tchin-nin wrote:

    Yes exactly, you set this formula on the DefaultDate property of your datepicker control.

    The formula says, if the form is a new item form, then set the date to Today(). If not (so if it is an Edit or a View form) set the date to the current item date (which will be the date saved when the item has been created). 

     

    If you don't want your users to change that date you can just hide the DataCard by setting the Visibile property to : false. 

     

    Théo


    I follow you but it doesn't accept that syntax.  My form name is FormGeneralInfoNS and I'm pretty sure it is in the New form mode.  When I type: If(FormGeneralInfoNS   it doesn't allow me to add a .FormMode right after that.  What I mean is that .FormMode is not a suggested option as I try and add it.  If i force it in the formula box, it will not accept it.  The closest formula it will accept is: If(FormMode=New, Today(), ThisItem.date)  Unfortunaltely, that does not produce a change of any kind.

  • Verified answer
    tchin-nin Profile Picture
    779 on at

    Sorry you have to use 

    if(FormGeneralInfoNS.Mode=New,Today(),ThisItem.Date)

     

    Théo

  • PowerAid Profile Picture
    on at

    @tchin-nin wrote:

    Sorry you have to use 

    if(FormGeneralInfoNS.Mode=New,Today(),ThisItem.Date)

     

    Théo


    That worked!  Thanks for the help.  I'm a PowerApps newbie.  Looking to use this to replace our InfoPath forms.   Lots of learning ahead.  Your help is much appreciated!

  • tchin-nin Profile Picture
    779 on at
    Glad to help you !
    Feel free to look for answer and/or ask some questions in this community to learn how to deal with PowerApps 🙂

    Théo

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 103

#2
WarrenBelz Profile Picture

WarrenBelz 82 Most Valuable Professional

#3
wolenberg_ Profile Picture

wolenberg_ 67 Super User 2026 Season 1

Last 30 days Overall leaderboard