How to get day name from glidedate in script-Include? Can anyone help me?

manimarans
Tera Contributor

In a Script Include, I have date(2019-04-12), now how to get day name(Mon-Sun) from that date?

1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Mani,

use below code to get the day part

var time = new GlideDateTime(date + ' 12:00:00');

var dayPart = time.getDayOfWeek();

if dayPart is 1 it means Monday; if it is 2 then it is Tuesday so accordingly you can compare

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader