What is the "gs.nowDateTime" equivalent Client side?

peterraeves
Mega Guru

I want to fill out date fields automatically, when a form is loaded. Very straightforward, but now it seems I can't call gs.nowDateTime client-side. I have read through the API, but can't seem to find the client-side equivalent. Is there no equivalent, because I shouldn't be doing something like this through client scripts? Or did SN just forget about it, which I doubt.

1 ACCEPTED SOLUTION

mayurt
Tera Expert

Hi Peter,



Please go through the following link hopefully that will help you.


Client Script Date/Time Functions


View solution in original post

7 REPLIES 7

ghsrikanth
Tera Guru

Have you tried the Javascript default date object?


var dt = new Date();


Yes, I did.



Capture.PNG


simonw
Tera Expert

Hi Peter,



I'd suggest using an AJAX script include to expose calls to server side functions.   That should give you access to the power of the gs DateTime functions and all the user timezone functionality which ServiceNow has already provided



Kind regards,



Simon


I tried that, but my ajax request didn't return as you can see in my other reply to Mayur Tejnani.



Edit: It works now, thanks!