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

Need help with the Date and time format

I am needing assistance with the output of the date and time format.

I have a flow that sends me an email with today's events from a Sharepoint List. On the email the dates and times look like the screenshot below. How can I get the dates and times to be in a user friendly format similar to how it is displayed in Sharepoint (screenshot #2)?

03-11-2019 8-56-49 AM.jpg03-08-2019 8-22-13 AM.jpg

10 REPLIES 10
Highlighted
Resident Rockstar
Resident Rockstar

Re: Need help with the Date and time format

Hi @Tbruns 

formatDateTime() is used for that.

Full info on Standard Date and Time Format Strings found at that link.

I can't see the format that put's the AM / PM on there but the below is close:

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

You would change utcNow() to the name of your field

formatDateTime('<name of your field>', 'MM/dd/yyyy HH:mm')

Thanks, Alan


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


Highlighted
Super User
Super User

Re: Need help with the Date and time format

Or,  more easily, just use a date Time control and select Convert time zone.

 

Rob
Los Gallardos

ConvertTimeZone.jpg

Highlighted
Resident Rockstar
Resident Rockstar

Re: Need help with the Date and time format

Yup @RobElliott 

Works perfectly, I've never had the time to test that but works a dream and easily provides the format I couldn't locate initially.Capture-357.png

Thanks, Alan


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


Highlighted
Super User
Super User

Re: Need help with the Date and time format

You're welcome kind sir.

Rob
Los Gallardos

Highlighted
Helper V
Helper V

Re: Need help with the Date and time format

Sorry I am still new to flow. Where would I insert the Convert Time Zone? 

03-11-2019 12-00-48 PM.jpg03-11-2019 12-01-16 PM.jpg

Highlighted
Super User
Super User

Re: Need help with the Date and time format

Looking at your flow you'd need to do it twice after Get items (make sure you rename them so you know which is which), once for Start time and once for End time. Then insert the relevant Converted time zone in the Create html table.

Rob
Los Gallardos

Highlighted
Helper V
Helper V

Re: Need help with the Date and time format

When i try to add the convert time zone after Get Items, it keeps adding it to "aaply to all" and then I am unable to select the Convert time zone in the HTML fields (they are not showing as options). Thank you!

Highlighted
Helper V
Helper V

Re: Need help with the Date and time format

When i try to add the convert time zone after Get Items, it keeps adding it to "apply to all" and then I am unable to select the Convert time zone in the HTML fields (they are not showing as options).

Can you assist in helping me figure this out please? Thank you!

Highlighted
Super User
Super User

Re: Need help with the Date and time format

Sorry @Tbruns ,it looks like I gave you bad advice as I've re-created your issue. It's strange.

My flow starts with a Sharepoint "When an item is created or modified" trigger and I've changed to to use a Compose control with the expression 

formatdatetime(triggerBody()?['Created'],'dd/MM/yyyy')
You can then select the output from the Compose in the html table as shown in the image below.
 
Rob
Los Gallardos
composeCreated.png
Highlighted
Helper V
Helper V

Re: Need help with the Date and time format

I get that is an invalid expression. I copied it from your post.

Helpful resources

Announcements
firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Users online (5,892)