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 / Add current date as de...
Copilot Studio
Answered

Add current date as default and date different calculation in Adaptive Card.

(1) ShareShare
ReportReport
Posted on by 110
Hi,
 
I am new to copilot studio and currently I am creating the Adaptive Card that has 2 date pickers: Start Date, End Date and a text input No of Days fields. 
 
I am wondering how I can add Today date as default value in date picker of Adaptive Card. I tried with Today() or Now() functions by switching JSON to Formula but it didn't work.
 
I also want to put the selected Start Date value as the default in End Date field. Is it possible to do so?
Additionally, is there a way to auto populate the day difference between start date and end date which will be selected by the user?
 
 
Appreciate your advice. Thank you! 
I have the same question (0)
  • Suggested answer
    Artur Stepniak Profile Picture
    1,539 Super User 2025 Season 2 on at
    Hello,
     
    you should be able to solve everything by using string interpolation. I assume that you've received an error related to parsing. You can use something like $"{Today()}", instead of just Today(). The same goes for other inputs - they should be in an interpolated string.
     
    Let me know if it helped you.
     
    In case of any other questions, let me know. If the answer helped you, mark it, so that others can benefit from it.
     
    Best regards,
     
    Artur Stepniak
    Interested in GenAI? Visit my site!
  • Suggested answer
    CN91 Profile Picture
    110 on at
    Hi @Artur Stepniak,
     
    Thank you for the advice but I have tried with few codes but they are not working. I also want to get the day difference based on start and end date. 
    "${Today()}"
    "${formatDateTime(utcNow(), 'yyyy-MM-dd')}"
  • Verified answer
    Artur Stepniak Profile Picture
    1,539 Super User 2025 Season 2 on at
    Hello,
     
    based on the schema docs for this field type (see: https://adaptivecards.io/explorer/Input.Date.html), under the value you should format the date string as YYYY-MM-DD. You can use the following formula: Text(Today(), yyyy-MM-dd). Just for the future: interpolated strings are something like this: $"", not this: "$". You should place a dollar sign before the quotes.
     
    In case of any other questions, let me know. If the answer helped you, mark it, so that others can benefit from it.
     
    Best regards,
     
    Artur Stepniak
    Interested in GenAI? Visit my site!
  • CN91 Profile Picture
    110 on at
     
    Thank you again! This power fx Text(Today(), yyyy-MM-dd) function is working but need to switch JSON editor to Formula in adaptive card.
    Unfortunately, data binding expressions with $"" or "$" is not working for me. It showed error in both JSON and Formula editor.
     
    Maybe adaptive cards do not inherently support direct formula-like dynamic binding between fields for client-side changes. 
  • Suggested answer
    Artur Stepniak Profile Picture
    1,539 Super User 2025 Season 2 on at
    Hello,
     
    it works for me:
     
     
    You always need to switch to formula if you have dynamic values. :-) Otherwise it'll accept only JSON format.
     
    In case of any other questions, let me know. If the answer helped you, mark it, so that others can benefit from it.
     
    Best regards,
     
    Artur Stepniak
    Interested in GenAI? Visit my site!
  • Suggested answer
    Artur Stepniak Profile Picture
    1,539 Super User 2025 Season 2 on at
    I'm sorry, I didn't mention about the curly brace... the syntax is: $"{EXPRESSION}"
  • CN91 Profile Picture
    110 on at
    Hi @Artur Stepniak,
     

    Apologies if I caused any confusion earlier. I didn’t clearly state that I had also tried using curly brackets. However, I believe we don’t even need them if we switch from JSON to Formula mode. We can directly use the Power FX functions instead.

    That said, I’m still struggling with referencing other fields within the adaptive card. It seems that the ${EXPRESSION} syntax doesn’t support dynamic, formula-like bindings between fields, as I mentioned in my previous reply.

    I would appreciate it if you could help with this.

    My goal is to display the difference in the number of days between the Start Date and End Date selected by the user within the same adaptive card. However, I’m unable to retrieve the values from the Start Date and End Date fields.

     

    Thank you!

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 251 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

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

#3
S-Venkadesh Profile Picture

S-Venkadesh 93 Moderator

Last 30 days Overall leaderboard