Showing results for 
Search instead for 
Did you mean: 
Level: Powered On

How to format Date Control form card for AM/PM?

Skill level:  creating my first complex PowerApp now.  Many years of InfoPath/SPD workflow experience.  I am having some challenges with form control formating and correct function usage and spend a lot of time on the PowerApps function reference page. I researched the questions below but can't get it working.


Scenario:  working on a canvas app that uses a SharePoint list as the data source.  This app includes several date fields where the user needs to select and submit the date, hour and minute, currently using a form to submit.  


Questions about configuring the default date/time date picker contol on a form card:

1. How to format the date picker Hour field to AM/PM (12 hour) instead of default 24 hour?  Seems this should be easy/property setting I missed?

2. How how to write a function (assume it will be applied to the DefaultDate property) for a date/time card to set the default date to 2 days from today if before 4pm, but default to 3 days from today if after 4pm, only on weekdays. Default on Saturday and Sunday should show the previous Friday default date.  Default Hour value should always be 8PM.


Thanks in advance - I very much appreciate this forum and will use heavily.

Super User
Super User

Re: How to format Date Control form card for AM/PM?

Hi @JGootee,

I can help with problem 1.  To get am/pm click on the Datepicker control and the Format property (Dropdown upper left hand side of screen.  Select:  DateTimeFormat.ShortDateTime

With respect to Problem2, perhaps I can get you started.  On the Edit form, select the card holding the datepicker.  Again in the properties dropdown, go to the Update property.  Here is where you would put a formula based on the value of the Datepicker control.  The result of the formula is what will be saved into the Datasource.  You would use the AddDate() function to reduce it to a result ie.  


When the Form was submitted, the value saved would be 23 hours from the date and time shown in the DatePicker. You would have to use and If() function to bifurcate the results as to whether it was before or after 4 pm.   By manipulating the Default for the datepicker control and the Update property of the card, hopefully you will be able to solve your problem. 

Level: Powered On

Re: How to format Date Control form card for AM/PM?

Thanks for your reply, @Drrickryp - much appreciated but I think I was not clear enough with my questions.


For item 1, I need to format the OOB Date Time picker control so that the Hours dropdown list is 12 Hour AM/PM format instead of 24 hour default style. Your suggestion added the Hours field to the date picker date control, which we need to show only the date.  See the Hours field below?  Clicking the Hours dropdown arrow now provides choices of 00-23.  I need to format that control to provide choices 1 AM, 2 AM...1 PM, 2PM, etc.  I also need to default the Hours field to 8 PM, but that should be simple after it is formated correctly.




Then, 2nd item is I need to set the DefaultDate property (I think) of date portion of the date picker control to Today+2, unless after 4 pm then DefaultDate property needs to be Today+3.  To make it more complicated, those defaults should only be applied on weekdays. On weekends, DefaultDate for the date picker date control should stay at previous Friday date.  I don't know how to write this function for the DefaultDate property.


Desired outcome is that customer opens the form and sees the default date per requirements above, but can chose any date further in the future. Can also change Hours field and minute field, and then their choices are written to the list when they click submit.  Didn't want to ask too much at once, but also need to restrict that date field so that they can not enter a date or hour earlier than the default date/hour.


I do have the part for Today()+ 2, but not sure how to add the rest of the function logic?

DefaultDate = Today()+2  see below.  Need to know how to do the If() logic to set that to Today()+3 after 4PM, only on weekdays (weekends use previous Friday value)





Thanks very much for your help.


Helpful resources


Watch Sessions On Demand!

Continue your learning in our online communities.


PowerApps Monthly Community Call

Next Wednesday, August 21st at 8am PDT

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


Power Platform World Tour

Coming to a city near you


PowerApps Community User Group Member Badge

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


Join PowerApps User Group!!

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


Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!


Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 198 members 3,751 guests
Please welcome our newest community members: