web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Automate
Unanswered

Get the Dates Only

(0) ShareShare
ReportReport
Posted on by 12

I'm creating a power automate workflow that will automatically get the list of people that has a vacation leaves in a week from a sharepoint calendar and it will send that list to me via email. I was able to get that output, but the date includes the time. I only want the time so I tried to fixed it using the initialize variable but I am getting an error. "InvalidTemplate. Unable to process template language expressions in action 'Initialize_variable' inputs at line '0' and column '0': 'The template language function 'formatDateTime' expects its first parameter to be of type string. The provided value is of type 'Null'."

I tried this expression

if( empty(item()?['EventDate']), null, formatDateTime(utcnow()[item()?['EventDate']], 'MMM-dd-yyyy') )

and the workflow run with no error, but the output only gives me the EndDate. The StartDate is blank or no dates on StartDate.

Any suggestions?  

See my current workflow.

dr3n09_0-1719486012066.png

 

Categories:
I have the same question (0)
  • anandm08 Profile Picture
    1,936 Super User 2024 Season 2 on at

    hi @dr3n09 ,

    try this

    if(empty(item()?['EventDate']), null, formatDateTime(item()?['EventDate'], 'MMM-dd-yyyy'))
  • dr3n09 Profile Picture
    12 on at

    Thank you @anandm08, I tried your suggestion. The workflow run without an error but the output only shows the Headers( Name, StartDate,EndDate and EventType) but no value.

  • anandm08 Profile Picture
    1,936 Super User 2024 Season 2 on at
    if(empty(item()?['EventDate']), null, formatDateTime(item()?['EventDate'], 'MM-dd-yyyy'))

    @dr3n09  try this

  • dr3n09 Profile Picture
    12 on at

    Hi @anandm08 I tried the updated expression and it gives me the same result. Only headers but no values.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 283

#2
David_MA Profile Picture

David_MA 256 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 225 Most Valuable Professional

Last 30 days Overall leaderboard