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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / formatDateTime using D...
Power Automate
Unanswered

formatDateTime using Dynamic Content

(0) ShareShare
ReportReport
Posted on by 16

Hello,

 

I am attempting to create an event in Outlook 'When a todo list item is created'. I continue to run into the issue that Outlook requires a time zone in its "start time" field. Todo does not, at least by default, provide a timezone which causes the outlook connector to automatically put in "T00:00:00". This causes the flow to fail, as it is not an accepted time zone. 

 

I am currently trying to use the 'formatDateTime' function to reformat it including my timezone (CST 06:00:00) but it returns the same error each time after failing;

 

"InvalidTemplate. Unable to process template language expressions in action 'Create_event_(V4)' 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'. Please see https://aka.ms/logicexpressions#formatdatetime for usage details.'."

 

The expression I am currently trying to use is;

 

formatDateTime(outputs('Get_a_to-do_(V3)')?['body/dueDateTime/dateTime'], 'yyyy/mm/ddThh:mm:ss')
 
My goal is to take the date/time that is given to me from Microsoft ToDo, format it to satisfy Outlook, and have my flow run through to create the event. The timezone is not important to me whatsoever, so if there is a way to create an outlook event without that option that would also work.
 
Thanks in advance
Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @emiller6,

     

    It looks like in this case you have triggered the flow with a To Do task which does not have a due date at all. That is why you are getting a null value error.

     

    So, I would build in some logic to handle these tasks without due dates. What do you want to do if a task does not have a due date?

     

    Btw, if you are using a To Do trigger action I would expect the expression to be something like below. I have also modified the datetime format slightly. As far as I am aware the Create event (v4) expects the yyyy-MM-ddTHH:mm:ss format.

     

     

    formatDateTime(triggerOutputs()?['body/dueDateTime/dateTime'], 'yyyy-MM-ddTHH:mm:ss')

     

    todo_createevent.PNG

     

  • emiller6 Profile Picture
    16 on at

    I have a different flow that is using data from a Microsoft Form submission to create the to do task. The to do task does in fact have a due date, and is required to via the flow I have been using to create it. The original flow works, and creates the todo task successfully with the right information. The second flow, the one I am describing, is supposed to take the information from the todo list and create an Outlook event.

     

    In short;

     

    Microsoft form submission --> ToDo Task

    ToDo Task --> Outlook Event

  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @emiller6,

     

    In that case can you share a screenshot of the setup of your second flow?

  • emiller6 Profile Picture
    16 on at

    Within the form I have created, it requires an answer in the "start time" field.

    2.PNG

  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @emiller6,

     

    I mean, can you share a screenshot of the ToDo Task --> Outlook Event flow setup (which you referred to as second flow 😉)?

  • jatcube Profile Picture
    508 on at

    @emiller6 your error would indicate that outputs('Get_a_to-do_(V3)')?['body/dueDateTime/dateTime'] does not have any value, not that it doesn't have the timezone info.

     

    However, I think there's a bit of confusion here. the outlook create event expects the time zones as literal expressions, such as "(UTC-06:00) Central Time (US & Canada)" which you can set manually in TimeZone. The Start and end time specifically does not need a timezone.

     

    What it does, it expects the time in the '2017-08-29T04:00:00' format where anything after the T is just the 24 hour time for the event. As I said above, the timezone is selected a step further.

     

    So if we take the above example and put 2017-08-29T04:00:00 as start time with UTC -6 as timezone, you'll create an event at 4am UTC-6. or if you change the timezone to GMT but leave everything as is, you'll create the event at 4am GMT.

     

    If you found this response useful, give it a thumbs up and don’t forget to mark your post answered to help others find the solution easier.

  • emiller6 Profile Picture
    16 on at

    This does give some insight, however previously when I tried to run these flows without the time zone data it consistently errors out in the same place, but says it cannot create the event because the date/time format is incorrect. This was when, in the start/end time fields, I had a dynamic content which inserted the “due date” from the todo task.

  • emiller6 Profile Picture
    16 on at

    I posted it previously, but here it is again.

    B698AEB6-4A2B-41C2-87F1-041B62564CFD.png

  • jatcube Profile Picture
    508 on at

    @emiller6 the due date is returned in the required format already, no need to format it.

    Due Date	dateTime		date-time	
    YYYY-MM-DDThh:mm:ss

      https://docs.microsoft.com/en-us/connectors/todo/ 

  • emiller6 Profile Picture
    16 on at

    I thought so to, yet when I don't do any formatting and just use the "due date" dynamic content this is what I get returned;

     

    String was not recognized as a valid DateTime.
    clientRequestId: a5b61bd7-a496-462f-9475-b95d6114667b

     

     "status"400,
      "message""String was not recognized as a valid DateTime.\r\nclientRequestId: a5b61bd7-a496-462f-9475-b95d6114667b",
      "error": {
        "message""String was not recognized as a valid DateTime."
      },
      "source""office365-cus.azconn-cus-001.p.azurewebsites.net"

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard