can't use 'gs.nowDateTime();' in scoped application

dave_edgar
Mega Guru

In a scoped application I'm allowed to use in my UI Action, what can I replace this with, can't find a simple answer:

current.resolved = gs.nowDateTime();

?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Dave,



use the following script in scripts background to get the current date/time in system



var gdt = new GlideDateTime();



current.resolved = gdt.getDisplayValue();



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

5 REPLIES 5

hmartind
Kilo Expert

you can try:



current.resolved = new GlideDateTime().getDisplayValue();


thankyou Hector. two options to do it.  



I think I tried this option but crucially forgot .getDisplayValue();


Ankur Bawiskar
Tera Patron
Tera Patron

Hi Dave,



use the following script in scripts background to get the current date/time in system



var gdt = new GlideDateTime();



current.resolved = gdt.getDisplayValue();



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Thankyou Ankur