- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2020 02:36 AM
We have a date/time fields on change form now we dont want to display seconds in it? so any idea how it can be done?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2020 03:15 AM
sample onLoad client script as below
something like this
function onLoad(){
var value = g_form.getValue('opened_at');
var date = value.split(' ')[0];
var time = value.split(' ')[1].split(':');
var finalValue = date + ' ' + time[0] + ':' + time[1] + ':' + '00';
g_form.setValue('opened_at', finalValue);
}
Output:
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
‎10-20-2020 02:41 AM
Hi,
you cannot remove that.
Other way is to use DOM manipulation which is not recommended.
you cannot remove them, you can change the value with a client script or display business rule to change them to 00 for the seconds
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
‎10-20-2020 03:03 AM
Okay thank you for your response, what is the logic to make it as 00 if we cant remove it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2020 03:15 AM
sample onLoad client script as below
something like this
function onLoad(){
var value = g_form.getValue('opened_at');
var date = value.split(' ')[0];
var time = value.split(' ')[1].split(':');
var finalValue = date + ' ' + time[0] + ':' + time[1] + ':' + '00';
g_form.setValue('opened_at', finalValue);
}
Output:
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
‎10-21-2020 03:30 AM
hi ankur,
I can use same logic on BR also right?