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 / Copilot Studio / Getting the right date...
Copilot Studio
Unanswered

Getting the right date format

(1) ShareShare
ReportReport
Posted on by 18
Hi, 
  I need some help working with dates , adaptive cards and Http requests.  Using CoPilot Studio for the first time, so bear with me
 
  My Adaptive card looks like this: 
 
   When the user selects a date, it is coming back to me in the format dd/mm/yyyy (even if I try to change the format in the card itself, nothing happens)
 
   In order to send the date to my Http call, I need the date to be in the format yyyy-mm-dd with the time element in the format 'T00:00:00.000Z'  
 
   I tried creating a variable setting it's value. But in the Set Variable function, using the datetimeformat gives me the following error 
 
 
 
 
 
 
   So I tried creating a formula like 
Year(Topic.startDate) + "-" + Month(Topic.startDate) + "-" + Day(Topic.startDate) + "T00:00:00.000Z")
 
   But this is falling over with an error that says 'cannot convert '-' into a number'  I have tried putting the whole thing into a 'Text' call, individual parts into a Text call.  Still get the same error.  I'm stumped.  
 
   Can somebody please help?  Goal is to to take the date entered by the user and send it to the Http request in the format 'YYYY-DD-DDT00:00:00.000Z' 
 
Thanks 
Categories:
I have the same question (1)
  • HenryJammes Profile Picture
    on at
    I think got this to work, like this:
     
     
    The Text function in Power Fx can output a date in what is called the UTC format.
     
    Text(Topic.SelectedDate, DateTimeFormat.UTC)
    

    But because it's not a date/time, you may find yourself with a wrong date being sent, given the time zone different between the user and UTC (I'm not exactly sure what your API endpoint expects).
     
    You can offset it by using this formula:
     
    Text(DateAdd(Topic.SelectedDate, - TimeZoneOffset(Topic.SelectedDate), TimeUnit.Minutes), DateTimeFormat.UTC)
     
     
     
     
  • CP-19070958-0 Profile Picture
    18 on at
    Thank you Henry.  That helps.  
     
    Would you point me to the right place for functions that I can use in CoPilot studio please, if you don't mind. I can't find the right source. 
  • HenryJammes Profile Picture
    on at
  • David_MA Profile Picture
    12,982 Super User 2025 Season 2 on at
    You can use the following expression:
     
    formatDateTime(parseDateTime(triggerBody()['text'],'en-us','dd/MM/yyyy'),'yyyy-MM-dd')
     
     
    Replace triggerBody()['text'] with the dynamic value that contains your date in the format dd/mm/yyyy. 

    This part of the expression tells Power Automate that you have a string value that you want to convert to an ISO8601 formatted date: parseDateTime(triggerBody()['text'],'en-us','dd/MM/yyyy'). 
     
    Then the formatDateTime expression converts the ISO8601 date to your desired format.

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 > Copilot Studio

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 261 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 198 Super User 2025 Season 2

#3
S-Venkadesh Profile Picture

S-Venkadesh 93 Moderator

Last 30 days Overall leaderboard