Date Format
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2024 08:52 AM
I'm having a problem when I enter a date, I have a script to generate a second date. The script does its job but the date format is wrong and needs to be modified. It needs to be 07/05/2024 but I'm getting 2024-07-05.
Here is the script I'm running
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
if(newValue === '')
{
g_form.clearValue('certificate_expiration_date');
}
var ga = new GlideAjax('myDateUtil');
ga.addParam('sysparm_name','getEndDate');
ga.addParam('sys_parm_issue_dt',newValue);
ga.addParam('sys_parm_how_many_months',27);
ga.getXML(cb);
// the callback function for returning the result from the server-side code
function cb(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
if(answer)
g_form.setValue('certificate_expiration_date',answer);
}
//Type appropriate comment here, and begin script below
}
Labels:
- Labels:
-
Service Desk
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2024 08:57 AM
Hi John,
Are you setting the value to a string field ? if it is a date type it should handle it on its own.
-Anurag
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2024 08:32 AM
'm and using Date format.