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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Get DateTime Field with JScript

(0) ShareShare
ReportReport
Posted on by 10

Hi everyone, 

Can you help me how can I get the value of a dateTime field value with JS.

Can I also get this field with the dd/MM/YYYY with Power automate ? 

Thank you for your help 

Best regards, 

Julien,

I have the same question (0)
  • Suggested answer
    Abdul Wahab Profile Picture
    12,119 Moderator on at

    Hi Julien_Admin,

    To get the value using JS. Use: formContext.getAttribute(arg).getValue(). For more details: https://learn.microsoft.com/en-us/power-apps/developer/model-driven-apps/clientapi/reference/attributes/getvalue.

    Yes, you can get the field with the dd/MM/YYYY with Power automate.

  • Verified answer
    Mohamed GRAIB Profile Picture
    2,504 Moderator on at

    Hi Julien,

    Please follow this link,

    community.dynamics.com/.../getting-only-date-from-date-time-field-using-javascript

    Please mark the answer as verified if that's resolve your problem.

  • Suggested answer
    CRMJetty Profile Picture
    3,512 on at

    Hello Julien_Admin 

    if you want take datetime field from page then you can use below method:

    //get value
    var startDate = Xrm.Page.getAttribute("new_dateauthorized").getValue();
    var year = startDate.getFullYear() + "";
    var month = (startDate.getMonth() + 1) + "";
    var day = startDate.getDate() + "";
    var dateFormat = year + "-" + month + "-" + day;

    //set value according to format

    Xrm.Page.getAttribute("new_dateauthorized").setValue(dateFormat);

    Using POWER AUTOMATED you can follow this link : https://d365demystified.com/tag/datetime-in-power-automate/

    I hope it helps,
    Thanks.
    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Portal.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 70

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans