Skip to main content
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Answered

Separate date and time

(0) ShareShare
ReportReport
Posted on by 225

I need the date of the actualend-field from the activity-entity. But the field saves time and date and I can't chance the settings to only date. I'm going to usw them in a flow. Is there a way to seperate them?    

  • Verified answer
    LeoAlt Profile Picture
    16,331 Moderator on at
    RE: Separate date and time

    Hi partner,

    As ba365guy said that we could not change the type of field since it has been published. I suggest that you could create another text field and use js code to get the date from actualedn-field and set it as a value to your new field.

    function onLoadDate(executionContext){
        var formContext = executionContext.getFormContext();
        var date1=formContext.getAttribute("new_dataandtime").getValue();
        if(date1!=null&&date1!=undefined){
            var time1=new Date(date1);
            var year=time1.getFullYear();
            var month=time1.getMonth()+1;
            var day=time1.getDate();
            var date2=year+"-"+month+"-"+day;
            var time2=new Date(date2);
            formContext.getAttribute("new_dateonly").setValue(time2);
        }
        
    }

    Hope it helps.

    Best Regards,

    Leo

  • Suggested answer
    ba365guy Profile Picture
    2,948 on at
    RE: Separate date and time

    Hi Ar0x

    I am afraid making changes to out of the box "activity" entity is not supported. 

    System doesn't allow you add / modify the fields in this entity. 

    You might choose to do changes (using new field / JavaScript) in "Task" entity (if it supports your requirement). 

    pastedimage1576256743890v1.png

    pastedimage1576256760268v2.png

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Separate date and time

    Hello,

    You can add a separated field and extract pure data into it using JS (like this - www.w3schools.com/.../jsref_getdate.asp) or plugin and use other field in your flow afterwards.

  • Suggested answer
    ashish12 Profile Picture
    3,079 on at
    RE: Separate date and time

    Change the field type to Data only than Date and Time.

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

News and Announcements

Now Available: 2025 Release Wave 2

Quick Links

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 51 Most Valuable Professional

#2
Ramesh Kumar Profile Picture

Ramesh Kumar 42

#3
David Shaw_UK Profile Picture

David Shaw_UK 27

Featured topics

Product updates

Dynamics 365 release plans