Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2024 11:55 PM - edited 03-04-2024 11:55 PM
Hello!
Irun simple function on background script.
var today = new Date();
dayOfWeek = today.getDay();
gs.print(dayOfWeek);
Today is Thuesday so I suposed to get result like "2" . but I receive "1" , did I make a mistake somewhere? why is that?
Thanks for any reply.
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 12:02 AM
Hello @Dominik1988
Try like below :
var t = new Date();
gs.print(t.getUTCDay())
Note : Use GlideDateTime API instead Date
Vishal Birajdar
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 12:26 AM
Don't know what happen but sudenly it started work for me even with my code, perhaps something was not refreshed on instance or on my browser? I hope this will work tommorow 🙂