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.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (2,264)