Hiding the time part of your datetime control in Dynamics 365

Recently I got a requirement where I needed to hide the time part of your datetime control. Basically I had a Datetime field of format date and time, but when the control is shown on the form, I only needed to show the date part and hide the time part.

I was searching and then our CRM bible – Microsoft docs saved me. There is nice method lying there – setShowTime which does just that.

So if my datetime field schema name is new_datefield1, to hide the time part all I need to do is – formContext.getControl(“new_fielddate1”).setShowTime(false);

Small functionality but quite useful and needed in almost every project.

You might also like the below posts

Debajit Dutta

(Dynamics MVP)

For consultation/ corporate training visit www.xrmforyou.com or reach out to us at info@xrmforyou.com

Our product offerings:

CRM-Sharepoint Attachment uploader and metadata manager (http://www.xrmforyou.com/sharepoint-integrator.html)

Notes Manager (https://debajmecrm.com/add-metadata-to-your-notes-and-attachments-in-dynamics-notes-metadata-manager-from-xrmforyou-com/)

Role based views for Dynamics 365 (http://www.xrmforyou.com/role-based-views.html)

Record Cloner for Dynamics 365 (http://www.xrmforyou.com/record-cloner.html)


Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe to get the latest posts sent to your email.

Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading