CRM 2013 – Toggle Time Portion of Date Fields

Roshan Mehta, 06 October 2013

The Xrm.Page.ui.control namespace of the Microsoft Dynamics CRM 2013 SDK provides a new function to programmatically show or hide the time portion of a Date and Time field in a supported manner. Here’s how!

 To show both the date and time portion of a Date and Time field:

Xrm.Page.getControl("ros_date").setShowTime(true);

To hide only the time portion of a Date and Time field:

Xrm.Page.getControl("ros_date").setShowTime(false);

Unfortunately, there are no SDK functions to allow you to show only the time portion of a Date and Time field, however you can achieve this using unsupported customizations.