I have the following code in the DefaultData field of a Date Picker in a card on a form:
If(ThisItem.'Opportunity Status'.Forecasting = DataCardValue92.Selected.Forecasting,Parent.Default, Now())
The code functions as expected, except that when I look at the data in that cell (in DataVerse), every date has midnight, UTC time stamped for the time (eg. "2/3/2021 6:00:00 AM")
If it's relevant, the DataVerse column in which this data goes has a data type of "Date and Time."
Do I need to adjust my Now() code so that it will output the actual time instead of midnight?
Thanks!
Solved! Go to Solution.
Date Picker controls only supply the Date, so they will always default to midnight as a Date and Time data element. You'll need to supply the time code from another control or somewhere and concatenate that with the date to create a Date Time string. Or use the date field from the date picker and Add hours and minutes to it.
@Pstork1 Thanks so much for your reply.... Yes, my bad & that makes complete sense.
Would you mind double checking the following code... If I placed this in the Default value of the Hour dropdown in the card (in addition to the code above being in the Date Picker):
If(ThisItem.'Opportunity Status'.Forecasting=DataCardValue92.Selected.Forecasting,Text(Hour(Parent.Default),"[$-en-US]00"),Text(Hour(Now()),"[$-en-US]00"))
Does that look like it would send the hour value correctly?
Date Picker controls only supply the Date, so they will always default to midnight as a Date and Time data element. You'll need to supply the time code from another control or somewhere and concatenate that with the date to create a Date Time string. Or use the date field from the date picker and Add hours and minutes to it.
@Pstork1 Thanks so much for your reply.... Yes, my bad & that makes complete sense.
Would you mind double checking the following code... If I placed this in the Default value of the Hour dropdown in the card (in addition to the code above being in the Date Picker):
If(ThisItem.'Opportunity Status'.Forecasting=DataCardValue92.Selected.Forecasting,Text(Hour(Parent.Default),"[$-en-US]00"),Text(Hour(Now()),"[$-en-US]00"))
Does that look like it would send the hour value correctly?
I think that would work, but without doing a test its hard to tell from just looking at the code.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
192 | |
45 | |
44 | |
38 | |
35 |
User | Count |
---|---|
262 | |
83 | |
82 | |
70 | |
69 |