
- 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 05:40 AM
var dateObject = new GlideDateTime();
var today = (dateObject.getDate()).toString();
dateObject.addDays(-1);
var yesterday = (dateObject.getDate()).toString();
gs.print(today);
gs.print(yesterday);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 08:01 AM
Thanks for the reply, Kalaiarasan, but unfortunately that doesn't help me in this situation.... however, it appears to have helped jayachandran In fact, it seems you're the only one who jayachandran seems to pay any attention to:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 08:34 AM
I apologise if I wasn't clear enough in my response and I should have added some statements to explain the solution.
But did you try to execute the script which I had provided ? Your question was specifically looking for function to return today's and yesterday's date ? Wasn't it ?
var dateObject = new GlideDateTime();
var today = (dateObject.getDate()).toString();
dateObject.addDays(-1);
var yesterday = (dateObject.getDate()).toString();
gs.print(today);
gs.print(yesterday);
Now the variable today and yesterday here stores the value you need. You just need to replace the variables in your code and it should work just fine. Correct me if I mistook your question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 08:36 AM
And my solution uses only uses out of the box methods that would provide an assurance to work even if you do any upgrade in future.