cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Medoomi
Helper V
Helper V

Now() outputting UTC midnight time, not actual time.

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!

2 ACCEPTED SOLUTIONS

Accepted Solutions
Pstork1
Dual Super User
Dual Super User

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.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

@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? 

View solution in original post

3 REPLIES 3
Pstork1
Dual Super User
Dual Super User

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.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

@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.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,922)