How to: Default a date field to today's date in PowerApps
Posted
Wednesday, May 30, 2018 2:31 PM
by
CoreyRoth
When you add a date field in PowerApps, I find that the current default date of 12/31/2001 is not very useful for me.
Changing the default date is not hard but you have to know where to look. First, you have to realize a date field is actually three different controls DateValue, HourValue, and MinuteValue. The default has to be set on each one.
Start by clicking on the Date Value where is says 12/31/2001. In the properties, go to the Advanced Tab and click the Unlock button. Now, iIn the property selector, look for DefaultDate and change the value to Now().
You'll notice the date changes to today's date now. You can also use date manipulation functions if you want to choose another date. Now, if you don't like the time defaulting to midnight, we can change that too. Click on the HourValue and choose Default in the property selector. Notice the formula it has.
Let's change that to use today's date and time to get the default value with the following formula.
Text(Hour(Now()), "00")
You'll notice the hour has now updated. PowerApps may apply a region identifier to your string when you update it. That won't mess anything up.
Now repeat the process for the MinuteValue with the following formula
Text(Minute(Now()), "00")
That's all there is to it. It may take a few extra steps than you expected but the process is pretty easy to follow.