How to chnage Date format from 2024-08-10 15:18:05 to 2024-Aug-10 03:18:01P M
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2024 01:17 AM
Hi All,
How to change date format from 2024-08-14 14:12:01 to 2024-Aug-14 02:12:01 PM,
In incident i want to show as a filed message.
getCallersLocalTime: function() {
var id = this.getParameter('sysparm_caller');
var callerObject = new GlideRecord('sys_user');
if (callerObject.get(id)) {
var time = new GlideDateTime();
var tz = Packages.java.util.TimeZone.getTimeZone(callerObject.getValue('time_zone'));
time.setTZ(tz);
var timeZoneOffSet = time.getTZOffset();
time.setNumericValue(time.getNumericValue() + timeZoneOffSet);
gs.info("Local time is : " + time); // prints Local Date time as : 2022-05-25 11:47:34
return time.toString();
}
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2024 03:06 AM
Hello @Dasari Srihari ,
According yo OOTB article
GlideDateTime - GlideDateTime(GlideDateTime gdt)
Instantiates a new GlideDateTime object set to the time of a specified GlideDateTime object.
- yyyy-MM-dd'T'HH:mm:ss.SSSZ
- MM/dd/yyyy HH:mm:ss
- MM-dd-yyyy HH:mm:ss
- MM-dd-yyyy HH:mm
- MM-dd-yyyy
- MM/dd/yy HH:mm:ss
- MM/dd/yyyy
- dd-MM-yyyy HH:mm:ss
- dd-MM-yyyy HH.mm.ss
- dd-MM-yyyy HH.mm
- dd-MM-yy HH:mm:ss
- dd-MM-yy HH.mm.ss
- dd/MM/yyyy
- dd-MM-yyyy
- yyyy-MM-dd HH:mm
- yyyy-MM-dd
- dd.MM.yyyy HH:mm:ss
- dd.MM.yyyy HH.mm.ss
- dd.MM.yyyy hh:mm:ss a
- dd.MM.yyyy hh.mm.ss a
- dd.MM.yyyy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2024 03:48 AM
Hi,
It is my expectation that there will be no necessity to draft scripts. By accessing the 'sys_user' table, you have the ability to modify the 'Date Format' field for an individual user or on a global scale, depending on your business needs.
Suresh.