Forum Discussion
Set default date on DatePicker from a drop down control event
- Jun 15, 2022
TRundle2022 yes you can set the DefaultDate property to change based on the selection in the dropdown. Make sure you have set the first item in the dropdown to "" then set the DefaultDate property of the date picker to:
If(Dropdown1.Selected.Value <> "",Today()+10,Today())Or you can do something like this to set it to a date based on which item in the dropdown has been selected:
If(Dropdown1.Selected.Value ="Anguilla",Today()+10,If(Dropdown1.Selected.Value= "Antigua",Today()+20, Today()+30))Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
TRundle2022 yes you can set the DefaultDate property to change based on the selection in the dropdown. Make sure you have set the first item in the dropdown to "" then set the DefaultDate property of the date picker to:
If(Dropdown1.Selected.Value <> "",Today()+10,Today())
Or you can do something like this to set it to a date based on which item in the dropdown has been selected:
If(Dropdown1.Selected.Value ="Anguilla",Today()+10,If(Dropdown1.Selected.Value= "Antigua",Today()+20, Today()+30))
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
I am trying to do something similar, but to populate the default date with the text in the drop down.
I have a data connection to another list where the user must select from the authorized dates, I'm pulling those dates into a drop down as text. Then I need to update the date with the selection.
Dates being pulled into DDdayOne value: Distinct(Filter('Class-Calendar', Category.Value = "Bluebeam" And Today() <= 'Start-Date'),'Start-Date')
DatacardValue2-DefaultDate = DDdayOne.SelectedText
How do I convert text into date format?
- ganeshsanapOct 19, 2022MVP
ColleenBristol You can try using DateValue() function in Power apps. Dates must be in one of these formats:
- MM/DD/YYYY or MM-DD-YYYY
- DD/MM/YYYY or DD-MM-YYYY
- YYYY/MM/DD or YYYY-MM-DD
- MM/DD/YY or MM-DD-YY
- DD/MM/YY or DD-MM-YY
- DD Mon YYYY
- Month DD, YYYY
Example
DateValue(inputStartDate.Text)Documentation: DateValue function in Power Apps
Please consider giving a Like if my post helped you in any way.