- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2018 05:01 AM
How to change the date format form 2018-07-20 07:37:35 to 20/07/2018 08:37:35.
I have created script include and client script for UTC end field. UTC end will display the GMT date and time automatically when we select the Incident End date and time. But here when I select the Incident date, UTC end date and time is displaying in different format. please can somebody help on how to display the date format in 20/07/2018 08:37:35.
Client Script:
var ga = new GlideAjax('PGIncidentAJAX');
ga.addParam('sysparm_name', 'getGMT');
ga.addParam('sysparm_date_time', newValue);
ga.getXML(processResponse);
function processResponse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue('u_utc_end', answer);
}
Server Script:
var PGIncidentAJAX = Class.create();
PGIncidentAJAX.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getGMT: function(){
var dt = this.getParameter('sysparm_date_time');
var gmt = new GlideDateTime();
// gmt.setStringParameter(dt.getByFormat("dd/MM/yyyy"));
gmt.setDisplayValue(dt);
return gmt;
},
type: 'PGIncidentAJAX'
});
Solved! Go to Solution.
- Labels:
-
Service Portal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2018 11:13 AM
I test below in my Dev instance and worked.
var PGIncidentAJAX = Class.create();
PGIncidentAJAX.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getGMT: function(){
var dt = this.getParameter('sysparm_date_time');
var gdt = new GlideDateTime();
gdt.setDisplayValue(dt);
var date = gdt.getValue().split(' ');
var dateonly = new GlideDate();
dateonly.setValue(date[0]);
var last = dateonly.getByFormat('dd/MM/yyyy') + " " + date[1];
return last;
},
type: 'PGIncidentAJAX'
});

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2018 05:28 AM
The date/time format is a system setting. Users can override it with their personal profile. It is not something you configure per form/table. That could lead to confusion if it were different throughout the system.
I recommend starting here to review how date/time is configured if you need more information:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2018 06:59 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2018 08:30 AM
How are you changing format for UTC start ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2018 08:33 AM
We havent written any script for UTC start Mike, its just taking the system defined date.