- 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:09 PM
Hi,
Are you passing a int in that like
gs.daysAgoEnd(int)
this will decide which endDatetime to return? If it is not passed then it will give you next day date time by default.
SO i will say pass 1 in that.
Thanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2020 12:14 PM
Thanks Ashutosh.
In this case I am passing 0, but my question is the same no matter what int I pass. If I pass a 1 at 5:00, will I get a different result than if I pass a 1 at 7:00 on the same day?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2020 12:27 AM
HI,
Whenever you run over the day the time will not change it will be same.
Thanks,
Ashutosh

- 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