cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Greg27
Super User
Super User

How to display date and time in an "Update item" field for a SharePoint list in a flow

In my flow I have an "Update item" action that updates a "Multiple lines of text" field in a SharePoint List. I am trying to display the date and time in a format like the following:

 

06/23/2022 4:23 PM

 

So I am using the following expression:

 

formatDateTime(utcNow(),'MM/dd/yyyy hh:mm tt')

 

The problem is that I am in the Eastern Time Zone which is UTC-4. Is there a way that I can get the date and time to reflect my time zone in my statement above or do I need to add another action to get the current date and time and not use utcNow() here?

 

If I need to use another action, what is the best and most efficient way to do this? 

1 ACCEPTED SOLUTION

Accepted Solutions
Shujaath_Khan
Solution Sage
Solution Sage

Hi @Greg27 

you can convert the timezone to your time zone as needed

either you can use convert timezone action as below

 

Shujaath_Khan_2-1655986796108.png

or if not in expression as you can try to convert the timezone as below

 

 

convertTimeZone(utcNow(),'UTC','Eastern Standard Time','HH:mm')

 

 

 

Hope it helps

Thanks

Please click Accept as Solution on this reply if it helped to solve your issue, and thumbs-up if you feel this is useful or important in other ways as a boost.

 

 

View solution in original post

12 REPLIES 12
Shujaath_Khan
Solution Sage
Solution Sage

Hi @Greg27 

you can convert the timezone to your time zone as needed

either you can use convert timezone action as below

 

Shujaath_Khan_2-1655986796108.png

or if not in expression as you can try to convert the timezone as below

 

 

convertTimeZone(utcNow(),'UTC','Eastern Standard Time','HH:mm')

 

 

 

Hope it helps

Thanks

Please click Accept as Solution on this reply if it helped to solve your issue, and thumbs-up if you feel this is useful or important in other ways as a boost.

 

 

@Shujaath_Khan 

If you use the action listed above, What value do you put in the "Base time" field?

Hi @Greg27 ,

Utcnow() would be your base time to be converted to eastern time 

The benefit what we would get here is besides formatting we're even converting to specific timezone 

Thanks

 

 

 

Greg27
Super User
Super User

I tried to use utcNow() as the Base time, but I got an error. Here is the error:

 

Greg27_0-1656000184155.png

 

Here is the screenshot of the action "Convert time zone":

 

Greg27_1-1656000250911.png

 

Do I have something wrong?

 

 

AbigailRRausch
Frequent Visitor

Hi, Greg! It looks like you need to put utcNow() as an expression, as right now it's just viewing it as a string called "utcNow()".

AbigailRRausch_0-1656006648056.png

 

@Greg27  Please write utcnow() in expression of dynamic content .

pls mark @Shujaath_Khan @reply as answer. He had given correct solution.

Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

@Hardesh /Gopenly.in

Greg27
Super User
Super User

@AbigailRRausch 

Thanks, that worked for the Base time, but my "Update item" field still shows the UTC date and time instead of the date and time for EST. I'm just trying to get the date and time in my "Update item" field to show in EST.

AbigailRRausch
Frequent Visitor

@Greg27  You're using the Output of the Converted Time in your Update Item action and it's still coming out weird, right?
Are you updating a Date/Time column type? Things can get weird that way, because Sharepoint stores Date/Time in UTC, and expects it as an input (it does the time conversion itself to transform to the Site time per the Site Settings).
Screenshot 2022-06-23 144245.png

Greg27
Super User
Super User

@AbigailRRausch 

Thanks Abigail!! That worked. I need to do this over and over in my flow as it is acting as a log file. Every action I do, I am saving the date and time the event happened. So I could end up doing this 5 or 6 times in the flow. Would I need to convert the date and time and then use the "Converted time" expression for each event I want to log?

AbigailRRausch
Frequent Visitor

@Greg27 
Awesome! Glad it's working. Yes, if it's logging at different times, you would just use the action again and the matching appropriate "Converted Time" Dynamic content each time. Good luck!

Greg27
Super User
Super User

Thanks for the help everyone!!

Greg27
Super User
Super User

For anyone who looks at this in the future... I figured out how to do it within an "Update item" action in a single Expression. Here it is:

 

formatDateTime(convertTimeZone(utcNow(),'UTC','Eastern Standard Time','M/dd/yyyy h:mm tt'),'M/dd/yyyy h:mm tt')

 

Not sure if there is a way to do this with less code, but this works.

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.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022- Season 2 has kicked off!

Users online (2,644)