Fix script does not update record correctly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2025 02:30 AM
Hi All,
I have a script that fixes a value on a record
how can I set it to 00:00:00??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2025 02:41 AM
You can modify your script to use GlideDateTime and set the time explicitly to 00:00:00. Here's how you can do it:
var gr = new GlideRecord('your_table_name');
if (gr.next()) {
var gdt = new GlideDateTime('2026-01-15 00:00:00');
gr.setValue('due_date', gdt);
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2025 05:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2025 03:02 AM
it's date/time so whatever value you set it will display as per logged in user's timezone
did you check value in XML is 00:00:00?
Seems your timezone is having 1 hour difference with GMT and hence it's showing as 1 hour ahead.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2025 05:30 AM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader