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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How can I hide the date part on a DateTime field using Javascript in crm 2013

(0) ShareShare
ReportReport
Posted on by 1,432

Hi all I want to hide data part on a DateTime field is any solutions please 

some suggestions 

thank u

*This post is locked for comments

I have the same question (0)
  • Cornel Croitoriu Profile Picture
    50 on at

    Hi,

    You can explore the dom, get the element id of the date part control and set it invisible.

    For example

    document.getElementById("datefieldname_d").style.display = "none";

    Will hide the whole data container for the field. You need to use a specific childNode of the element in order to achieve your scenario.

  • Suggested answer
    Deepesh161 Profile Picture
    6,317 on at

    A supported method would be to instead create a new attribute on the entity (a text field called Time) and put that on the form. Take your current DateTime field on the form, make it invisible, then use a JavaScript event on the on the onChange event of the form to validate that it is a valid time.

    Then in the onSave event of the form, copy the time over to the Date Time attribute that is hidden on the form (also remember to mark it as Force Submit Always).

    That way the user won't be forced to pick a day (although the time selection will be arguably more difficult)

  • KNK Profile Picture
    1,432 on at
  • Cornel Croitoriu Profile Picture
    50 on at

    You said you need to hide the date part, not time. The time can be hidden also from the attribute definition (date-only)

  • Saroj Das Profile Picture
    3,355 on at

    hi as i understood, you want to keep only time and remove the date part.  for example you have the date format like  "2015-01-20 01:00:00 UTC" so you can do like below.

    var datetime ="2015-01-20 01:00:00 UTC";
    var myTime = datetime.substr(11, 8);
    alert(myTime) // 01:00:00 (output). Then you can set it to your field.

    Thanks.
  • KNK Profile Picture
    1,432 on at

    Hi Saroj das

    Please Refer this am Trying like this

    www.magnetismsolutions.com/.../Hiding_Date_in_CRM_DateTime_Attributes.aspx

    find below url

    thank u

  • KNK Profile Picture
    1,432 on at

    Hi Cornel Croitoriu  no am trying hide date only not time

    pls refer this

    www.magnetismsolutions.com/.../Hiding_Date_in_CRM_DateTime_Attributes.aspx

    thank u

  • Saroj Das Profile Picture
    3,355 on at

    hi KNK, the link specified by you is for CRM 4.0 so it may not work in CRM latest version. If you could post the code for latest version CRM, it will help to other also.

    Thanks.

  • KNK Profile Picture
    1,432 on at

    thnks

  • Suggested answer
    Mahadeo Matre Profile Picture
    17,021 on at

    You can do by adding one HTML web resource.. 

    here are all details 

    http://mahadeomatre.blogspot.com/2015/01/show-only-time-for-date-time-attribute.html?_sm_au_=iVVPRTf5DZ4Z7MQ6

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans