fetching hour form a glidedatetime value
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2024 07:48 AM
Hello Experts,
Can anyone tell how to fetch hour from a glidedatetime value.
I am using this script
var gdt = new GlideDateTime ("2017-03-31 15:13:43");
var gdtsplit = gdt.getDisplayValue().split(' ')[1].split(':');
gs.print(gdtsplit[0]);
It is returning 17 whereas it should return 15.
Thanx in advance
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2024 08:30 AM
@deepika46 Try with script below.
var gdt = new GlideDateTime("2017-03-31 15:13:43");
var timeStr = gdt.getValue();
gs.print(timeStr.split(' ')[1].split(':')[0]);
Thanks,
Harsh