- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2020 08:35 AM
I have a date field on a record, I would like to pull the date and get the day of the week from it. Heres what I have so far:
var grDay= new GlideRecord('x_utsll_time_manag_hour_tracker');
grDay.query();
while (grDay.next()) {
var testdate = grDay.date;
var dy = testdate.getDayofWeekLocalTime();
gs.info('Day:'+dy);
}
Doesn't seem to work, getting an error in the log
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2020 08:44 AM
try
var grDay= new GlideRecord('x_utsll_time_manag_hour_tracker');
grDay.query();
while (grDay.next()) {
var gdt = new GlideDateTime(grDay.date + ' 12:00:00');
var dy = gdt.getDayofWeekLocalTime();
gs.info('Day:'+dy);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2020 08:55 AM
Try using below:
Please note there is capital O in getDayOFWeekLocalTime()
Please mark my answer correct/helpful , If it helped you.
var grDay= new GlideRecord('x_utsll_time_manag_hour_tracker');
grDay.query();
while (grDay.next()) {
var testdate = new GlideDateTime(grDay.date);
var dy = testdate.getDayOfWeekLocalTime();
gs.info('Day:'+dy);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2020 09:04 AM
Made that change and still got an error:
org.mozilla.javascript.EcmaError: Cannot find function getDayOfWeekLocalTime