- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2016 03:59 AM
Hi Team,
How can we find out day in server side scripting.For example, in 2016-12-13, I want to print '13'. Is there any functions to get the day.
Thanks & Regards,
Keerthi
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2016 04:10 AM
Just 2 lines will print the day of month: var gdt = new GlideDateTime(); gs.print(gdt.getDayOfMonth());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2016 04:04 AM
Hi Keerthi, the last Friday Challenge was about it if you want to see some examples
Friday Challenge - 18 - Birthday and un-birthday
Of course, it'll be the "GlideDateTime" API which will give you the necessary functions to succeed
https://developer.servicenow.com/app.do#!/api_doc?v=helsinki&id=c_APIRef.dita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2016 04:04 AM
Hi Keerthi,
You can use gs.now() or GlideDate() methods to get the todays date and then by using substring method you can get the required number(year,month,date,day).
GlideDate and GlideDateTime examples
http://wiki.servicenow.com/?title=GlideDateTime
Thanks and regards
Swamy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2016 04:10 AM
Just 2 lines will print the day of month: var gdt = new GlideDateTime(); gs.print(gdt.getDayOfMonth());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2023 10:54 PM
Hello @anurag92
using your script i am getting backend value like 21 but i want to print day name like monday .
can we print day name if is it possible please guide me on this.
Thank You.