- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-02-2021 06:10 AM
Hello All,
On the RITM form I want to update the date variable. When I update the date variable the date is in the 'yyyy/dd/MM' format. I want the date variable is in the 'MM/dd/yyyy' format using onChange client script.
Anyone please help me.
I will appreciate the response.
Thank you.
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-04-2021 10:29 PM
GlideAjax Example
Use this script include and send the value which is in yyyy/dd/MM format
var MyConversion = Class.create();
MyConversion.prototype = {
initialize: function() {
},
convertDateFormat: function(){
var incomingDate = this.getParameter('sysparm_format') + ' 00:00:00';
var format = 'yyyy/dd/MM HH:mm:ss';
var gdt = new GlideDateTime();
gdt.setDisplayValue(incomingDate,format);
var gd = new GlideDate();
gd.setValue(gdt.getDate());
return gd.getByFormat("MM/dd/yyyy");
},
type: 'MyConversion'
};
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-02-2021 06:51 AM
I have requirement to set the date variable as 'MM/dd/yyyy' format. However when I update the RITM form the date is in 'yyyy/dd/MM' format.
How to covert into 'MM/dd/yyyy' format ? using onChange Client script.
Thank You.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-02-2021 06:59 AM
Hi,
you can use string manipulation as easiest approach
OR
You need to use onChange Client Script with GlideAjax
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-02-2021 07:20 AM
Thanks for the reply !!
Could you please share your script.
I will appreciate your response !!
Thank You.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-04-2021 10:29 PM
GlideAjax Example
Use this script include and send the value which is in yyyy/dd/MM format
var MyConversion = Class.create();
MyConversion.prototype = {
initialize: function() {
},
convertDateFormat: function(){
var incomingDate = this.getParameter('sysparm_format') + ' 00:00:00';
var format = 'yyyy/dd/MM HH:mm:ss';
var gdt = new GlideDateTime();
gdt.setDisplayValue(incomingDate,format);
var gd = new GlideDate();
gd.setValue(gdt.getDate());
return gd.getByFormat("MM/dd/yyyy");
},
type: 'MyConversion'
};
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-05-2021 12:20 AM
Thanks !! Its Worked !!
Thank you.