How is gs.daysAgoEnd calculated?

Jase2
Tera Contributor

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.

1 ACCEPTED SOLUTION

MrMuhammad
Giga Sage

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

 

Regards,
Muhammad

View solution in original post

7 REPLIES 7

Jase2
Tera Contributor

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.

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. 

find_real_file.png

 

Now I run test right now almost after 30 mins of interval. Now you can see time is still the same. 

find_real_file.png

 


Please mark my response CORRECT if it answered your question.

Thanks & Regards,
Sharjeel

 

Regards,
Muhammad

Jase2
Tera Contributor

Did you run your first test before 06:59:59 and your second test after 06:59:59?