
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 05:20 AM
I need to get a date range between 6:30am yesterday and 6:30am today.
I know I can do this:
closed_atBETWEENjavascript:gs.dateGenerate('2016-11-01','06:30:00')@javascript:gs.dateGenerate('2016-11-02','06:30:00')
But as you see I'm hard-coding the day/month/year.
I'm curious, will this work?
closed_atBETWEENjavascript:gs.dateGenerate(gs.daysAgoStart(0),'06:30:00')@javascript:gs.dateGenerate(gs.daysAgoEnd(0),'06:30:00')
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 06:04 AM
Something like this may work:
closed_atBETWEENjavascript:gs.dateGenerate(gs.beginningOfYesterday().slice(0,10),'06:30:00')@javascript:gs.dateGenerate(gs.beginningOfToday().slice(0,10),'06:30:00')
Please feel free to connect, follow, mark helpful / answer, like, endorse.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 07:43 AM
Yes, I glazed over your last sentence which you clearly explained this. My apologies.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 08:32 AM
I'm going to mark this correct. The only thing is it has to be done in reverse:
closed_atBETWEENjavascript:gs.dateGenerate(gs.beginningOfToday().slice(0,10),'06:30:00')@javascript:gs.dateGenerate(gs.beginningOfYesterday().slice(0,10),'06:30:00')
For some reason I got tons of errors when I tried putting gs.beginningOfToday() first. Switching the yesterday and today resolved it.
Thanks John for all your help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 08:45 AM
According to http://wiki.servicenow.com?title=Operators_Available_for_Filters_and_Queries, the smaller value comes first for BETWEEN:
between | [SLA due][between][Yesterday] and [Today] | BETWEEN | sla_dueBETWEENjavascript:gs.daysAgoStart(1)@javascript:gs.daysAgoEnd(0) |
As long as you're getting the expected results without errors, I'd say let's go with it.