- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-01-2020 12:02 PM
I have a scheduled job that runs at 3:00 in the morning. In there it uses gs.daysAgoEnd. I'm not sure why, but when I run that later in the day it shows the day ends at 5:59:59 the next day. My question is does the time of day that you run gs.daysAgoEnd matter? When it runs at 3:00 will it still show the days ends at 5:59:59 the next day or the same day? I would think that it would be same day, but the results I get from the scheduled job seem to show that it uses the next day.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-01-2020 12:28 PM
Hi Jase,
The time doesn't matter it will return a date and time for the end of the day a specified number of days ago.
for a quick test run below script in the background script after 10 - 15 mins interval and observe the date time in the output. Time will never change.
var d = gs.daysAgoEnd(1);
gs.info(d);
Output - GMT date time string.
Please mark this correct & helpful if it answered your question.
Thanks & Regards,
Sharjeel
Muhammad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-01-2020 12:43 PM
Thanks Muhammad,
I thought about doing what you suggested, but I really didn't want to have to wake up at 5:00 in the morning to run the test. What you are suggesting does seem to be reflected in how the script is currently running, I just wanted to make sure.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-01-2020 12:48 PM
For quick test you can use background script[Our friend when it comes to testing server side script]. No need to stay awake. Let me show you.
I ran test 30 mins back and I got below output. Please note the time.
Now I run test right now almost after 30 mins of interval. Now you can see time is still the same.
Please mark my response CORRECT if it answered your question.
Thanks & Regards,
Sharjeel
Muhammad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-01-2020 01:12 PM
Did you run your first test before 06:59:59 and your second test after 06:59:59?