How to change the date format (YYYY,MM,DD) to (DD,MM,YYYY) in the case fom.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2022 01:45 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2022 02:03 AM
Hi if you do that it will impact to all the date fields in the system.
Refer here
https://community.servicenow.com/community?id=community_question&sys_id=e51e9e3b1bc50450a59033f2cd4bcb68
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2022 02:15 AM
Hello,
If you do this , it will be effected across the instance.But anyhow if you want to change the format and if you are okay with changing the date format for fields across the instance please follow below steps
1) Open sys_properties table
2) search for this property named as "glide.sys.date_format"
3)Change the format according to your requirement from yyyy-MM-dd --> dd-MM-yyyy in value field
OR --> Follow below process for work around
I have a work around for it
please follow below steps
- Create a New Field called 'Date' of type String
- Click 'Advanced View'
- On 'Calculated Value' tab, check 'Calculated'
- Insert the code below into the 'Calculation' field, substituting with your field back end name
(function calculateLongDate(current) {
var gDateTime = new GlideDateTime(current.u_date.getDisplayValue()); // repalce with backend name of old created field with type date
var gDate = gDateTime.getDate();
var dt = gDate.getByFormat('dd/MM/yyyy');
return dt;
})(current);
- Add your field on to the form below Date field and observe the format
Please accept this solution if it helped you some or the other way
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2022 02:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2022 02:30 AM
Please try to give some value in the Date filed which you created earlier and then save the form and see the value
And make sure you have replaced the old field name in the above script that i pasted
(function calculateLongDate(current) {
var gDateTime = new GlideDateTime(current.u_date.getDisplayValue()); // repalce with backend name of old created field back end name with type date
var gDate = gDateTime.getDate();
var dt = gDate.getByFormat('dd/MM/yyyy');
return dt;
})(current);
Updated for your reference again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2022 02:35 AM