We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Get the day of the week

Lidi2115
Tera Contributor

Hi,

Can I get the date of the next Wednesday in a client script ou BR?

3 REPLIES 3

Aman Kumar S
Kilo Patron

You can refer to below article to achieve this:

Calculating the day of the week on a glide date (in a client script)

 

Feel free to mark correct, If I answered your query.

Will be helpful for future visitors looking for similar questions 🙂

Best Regards
Aman Kumar

Mohith Devatte
Tera Sage

hello ,

Yes you can get it in BR please use below code

var gdt = new GlideDateTime();
var day = gdt.getDayOfWeek();
if(day==3) // 1- monday 2-tuesday 3-wed 4-thursday 5-friday 6-saturday 7-sunday

{
gs.info('its wednesday');
}
please refer to below link for more details
https://developer.servicenow.com/dev.do#!/reference/api/quebec/server_legacy/c_GlideDateTimeAPI#r_GDT-getDayOfWeek?navFilter=week

 

Please mark this accepted solution if it solved your issue

Not applicable

There is a method available in the GlideDateTime library:

getDayOfWeekLocalTime()

If you want to do this via client script, you can use the native JS 'Date()' functionality