How to change date format for one field without impacting overall instance?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 04:35 AM
Hello, @Ankur Bawiskar @shloke04 @Amit Gujarathi
Is it possible to change the date format from YYYY-MM-DD to DD-MM-YYYY for a single field on specific table without impact on other tables (overall instance)?
If yes, please share your suggestion. It would be highly appreciated.
Thanks a lot.
BR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 04:37 AM
Please refer this video
https://youtu.be/rEwOktAvtcA?feature=shared
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 04:58 AM
Thanks for your response.
In the video the explanation was regarding overall instance date format change, my question was can we do to one field on a particular table alone without disturbing other tables.
BR,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 05:07 AM
Yes, in ServiceNow, you can change the date format for a single field on a specific table without impacting other tables or the overall instance. You can achieve this by configuring a Display Business Rule specifically for that field. Here's how:
-
Identify the Field: Determine the field on the specific table for which you want to change the date format.
-
Create a Display Business Rule: Go to
System Definition
>Business Rules
and create a new Business Rule. Make sure to select the "Display" type. -
Set Conditions: Configure conditions to ensure the Business Rule only affects the specified field on the desired table.
-
Script Action: Write a script action in the Business Rule to modify the date format when the field is displayed.
Here's a sample script that changes the date format from YYYY-MM-DD to DD-MM-YYYY for a field named my_date_field
on the incident
table:
(function executeRule(current, previous /*null when async*/) {
// Check if the field is the one you want to format
if (current.name == 'my_date_field') {
// Change the date format from YYYY-MM-DD to DD-MM-YYYY
var dateValue = current.getValue(); // Assuming 'my_date_field' is the field name
var formattedDate = formatDate(dateValue); // Format the date
// Set the formatted date back to the field
current.setValue(formattedDate);
}
})(current, previous);
// Function to format the date as DD-MM-YYYY
function formatDate(date) {
var parts = date.split('-');
return parts[2] + '-' + parts[1] + '-' + parts[0];
}
- Apply the Business Rule: Once you've created the Business Rule, set it to run on the
display
event for the specified table.
Regards,
Vaishnavi Lathkar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 05:08 AM
@Ksnow I don't think if you can control the date format on your instance for a specific field, If you really wish to keep date in a different format then I recommend creating a normal string field and store the date in your desired format.