- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2024 07:49 AM
I'm passing over the value from the time_worked field via g_scratchpad but noticed it is also passing over a placeholder date (e.g 1970-01-01 01:00:00).
g_scratchpad.savedTime = current.time_worked;
Is there a easy way to simply remove the date so that the passed over value is just "01:00:00"?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2024 07:59 AM
Hi @MBarrott
g_scratchpad.savedTime = current.time_worked.toString().split(" ")[1];
If my response helps you resolve your issue. Kindly mark it as helpful & correct. It will be helpful to future readers
Thanks,
Sejal
Thanks & Regards
Sejal Chavan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2024 07:57 AM
Try this
var gdt = new GlideDateTime(current.time_worked);
gt = gdt.getTime();
g_scratchpad.savedTime = gt.getByFormat('hh:mm:ss');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2024 07:59 AM
Hi @MBarrott
g_scratchpad.savedTime = current.time_worked.toString().split(" ")[1];
If my response helps you resolve your issue. Kindly mark it as helpful & correct. It will be helpful to future readers
Thanks,
Sejal
Thanks & Regards
Sejal Chavan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2024 08:04 AM
Hi @sejal1107 - perfect, thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2024 08:00 AM
Yes,
var ndt = new GlideDateTime();
var secs = ndt.toString().substr(11);
gs.info('ndt = ' + ndt + ', seconds = ' + secs);
results in:
*** Script: ndt = 2024-10-24 14:59:51, seconds = 14:59:51