cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
New Member

Formatting a date field that is conditionally displayed

I am having trouble formatting and printing a date field in an e-mail.

 

The date field in question only needs to be entered and displayed on the e-mail if a date has been entered, and I want the date formatted into dd-MM-yyyy instead of the default yyyy-mm-dd format

 

I have tried the following expression, but I keep getting an error saying that the expression is invalid:

if(empty(triggerBody()?['EndDate']),null,formatedatetime(triggerBody()?['EndDate'],’dd-MM-yyyy’))
 

However the following expression (without the date formatting) works:

if(empty(triggerBody()?['EndDate']),null,triggerBody()?['EndDate'])
2 REPLIES 2
Super User III
Super User III

Hi!

There is a typo in the WDL function name

formatedatetime ->formatdatetime

 

If the problem persists, please share triggerBody()?['EndDate'] contant that make the expression fail

 

Hope this saves your day



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Good catch!

 

@NaydoJ 

If not, try with  formatDateTime(item()?['EndDate'], 'dd-MM-yyyy')

Helpful resources

Announcements
PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (9,616)