The CreatorCon Call for Content is officially open! Get started here.

gs.now returning yesterday's date!?

georgechen
Kilo Guru

Hi folks,

Just wondering if you could assist with the gs.now this time.       the published date is a date type in KB_knowlege table (knowledge base), a client has raised the published date set to yesterday's date when she created a new KB.     I was able to reproduce this in the early morning, and found a before business rule is setting the published date.   Please see screenshot below

find_real_file.png

gs.now() in script background seems to output today's date and it does not output the time,

find_real_file.png

find_real_file.png

the question come to my head, is the gs.now() reflecting client's local time?

Any feedback is appreciated.

Kind regards,

1 ACCEPTED SOLUTION

Did you try it like this?


var gdt = new GlideDateTime();


gs.print(gdt.getDate());



That is displaying properly for me.


View solution in original post

5 REPLIES 5

The ServiceNow Wiki content is no longer supported. Updated information about this topic is located here: GlideDateTime
 


Visit http://docs.servicenow.com for the latest product documentation