Current time in user's timezone

snowtech1
Tera Expert

Can anyone help me with the script to get the time in the user's timezone?

var gt = new GlideDateTime();

var gdt = gr.getTime();

gs.print(gdt.getDisplayValue());

The script above is displaying with an error of (-1) hour.

Thanks in advance.

1 ACCEPTED SOLUTION

Use below if you just need time



var gt = new GlideDateTime();


gs.print(gt.getDisplayValue().split(' ')[1]);


View solution in original post

12 REPLIES 12

Thanks It works.

var gt = new GlideDateTime();


var time = gt.getDisplayValue().split(" ")[1];


gs.print(time);


SanjivMeher
Mega Patron

Mark it answered if it worked for you to remove it from unanswered list. Let me know, if you still find any issue.