- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2016 02:25 AM
I wrote a code :
var gdt = new GlideDateTime();
var date = gs.beginningOfThisMonth(gdt);
gs.print(date);
*and I get a perfect result however when I check which day the date comes on it gives undefined answer. for this I used:
gs.print(date.getDayOfWeek());
* If I use getDayOfWeek() function separately it answers correct. however If I use it after beginningOfThisMonth it answers as undefined.
How day I check Day of first Day of Month?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2016 02:38 AM
Try below script
var date = gs.beginningOfThisMonth(gdt);
var gdt = new GlideDateTime(date);
gs.print(date);
gs.print(gdt.getDayOfWeek());
Thanks,
Mihir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2016 02:38 AM
Try below script
var date = gs.beginningOfThisMonth(gdt);
var gdt = new GlideDateTime(date);
gs.print(date);
gs.print(gdt.getDayOfWeek());
Thanks,
Mihir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2016 03:42 AM
Thank you it is perfect

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2020 02:43 PM
This works great, random question though, How does the compiler not throw an error since gdt isnt technically defined until the next line? It's kind of confusing. Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2016 02:45 AM
Hi Shreya,
Define 'date' again as GlideDateTime object then use getDayOfWeek() function;
var newdate = new GlideDateTime(date);
newdate.getDayOfWeek();
Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.
Thanks,
Deepa