- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2018 01:51 PM
Hello,
I need to change the format of a specific date field on an HR case form from short (MM/DD/YYYY) to long (MMM DD, YYYY).For instance, 03/28/2108 should be March 28, 2018. I need to change the date format only for a single field and not across the system (I am on Kingston)
I tried creating a new System Property (long_date_format) and adding it to the Attribute in the Dictionary Entry of the field, but couldn't get it to work. I am thinking I might need to use a script include, but I am new to scripting. So before I try that, first wanted to check with you folks to see if there is an easier solution. If anyone could point me in the right direction, that would be really helpful!!
Many thanks!!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2018 05:45 PM
- Create a New Field called 'Long Date' of type String
- Click 'Advanced View'
- On 'Calculated Value' tab, check 'Calculated'
- Insert the code below into the 'Calculation' field, substituting 'resolved_at' with your field
(function calculateLongDate(current) {
var gDateTime = new GlideDateTime(current.resolved_at.getDisplayValue());
var gDate = gDateTime.getDate();
var longDateTime = gDate.getByFormat('MMMM dd,YYYY');
return longDateTime;
})(current);
- Add the field to the form, under your Date field (example below)
Date/Time formats are documented here.
Similar to the Business Rule solution, it only updates on form load.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2018 05:50 AM
Hi Supriya,
Thanks a lot for taking the time to look into this. I did try this code (the modified one) but while the month and year displayed correctly, the day was not accurate. For instance 08-04-2018 displayed as August 55, 2018 instead of August 4, 2018
Paablo's solution works for me, so please do not spend any time trouble shooting this for me! I just wanted to let you know the error I met with this code.
Thanks again!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2018 12:55 AM
Can you elaborate more on your requirements?
Some questions specifically:
- Does this field still need to be editable by the Date/Time picker
- Is it for display purposes only
- What is the usage of this field
- Why is this needed
What you are requesting will likely require coding and customisation to achieve.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2024 09:23 PM
Hi Nerd, I have a requirement where I need the field to be editable by the date/time picker, for this requirement the above solution will now work. Is there any way I can achieve this requirement?
In glide.sys.date_format the format is dd-MMM-yy. But for a specific field in contract table want format as DD-MMM-YYYY.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2018 05:45 PM
- Create a New Field called 'Long Date' of type String
- Click 'Advanced View'
- On 'Calculated Value' tab, check 'Calculated'
- Insert the code below into the 'Calculation' field, substituting 'resolved_at' with your field
(function calculateLongDate(current) {
var gDateTime = new GlideDateTime(current.resolved_at.getDisplayValue());
var gDate = gDateTime.getDate();
var longDateTime = gDate.getByFormat('MMMM dd,YYYY');
return longDateTime;
})(current);
- Add the field to the form, under your Date field (example below)
Date/Time formats are documented here.
Similar to the Business Rule solution, it only updates on form load.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2018 05:42 AM
Thanks a lot Paablo, it worked!
And, to answer your initial query:
Essentially, I only need this field to populate a PDF document in the case. The client wants the date in the document to be in the long format. So this will be hidden, read-only field that will be used in the document.
Many thanks again for your help! It is much appreciated!