- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2025 12:02 PM
I have a Date/Time field in one of the RITM that I need to default to current date/time.
Using javascript: gs.now(); fills in the Date but the time is 00:00:00.
I have tried using : javascript: new Date().toLocaleString();
However, it ends up giving me a weird time.
It can't be this difficult to just have a default date & time...! Please help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2025 08:35 PM
Hi @MWright1
Try the below script in the default value.
javascript:new GlideDateTime().getDisplayValue();Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2025 08:35 PM
Hi @MWright1
Try the below script in the default value.
javascript:new GlideDateTime().getDisplayValue();Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2025 05:08 AM
Thank you very much!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2025 08:46 PM
to see the now time in the logged in user's timezone use this
javascript: var dateTime = new GlideDateTime().getDisplayValue(); dateTime;
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-06-2025 05:26 AM
@MWright1 Glad it helped.
