Adding 1 hour to current date is not working as intended

Manoj82
Kilo Expert

Hi,

I have a requirement to set the time from a UI page onto a scheduled job based on the current time

script :(to update the time on the job)

var gdt = new GlideDateTime(gs.nowDateTime());
var hours = 60*60*1;
gdt.addSeconds(hours);

and based on this I set my schedule job date:
rec.run_start = gdt.getValue();

Instead of updating the time on scheduled job to next hour )irrespective of AM or PM ) it only update the job date to AM 

Can you please tell me what is the issue and how to fix this

Regards,
Manoj

8 REPLIES 8

I just tried my in background script in dev instance and I'm getting correct date and time

current  Time 02:03:03 PM her in NY

find_real_file.png

find_real_file.png

Can you share whole script so I can try to reproduce same issue as yours.

Hi Mike,

I am trying to set the date on a scheduled job from a Script include:

var gdt = new GlideDateTime(gs.nowDateTime());
var hours = 60*60*1;
gdt.addSeconds(hours);

var rec = new GlideRecord('sysauto_script');
rec.get('name', 'Create Symitar Upload');
rec.run_type ='once';
rec.run_start = gdt.getValue();
return rec.update();

So I am updating the date based on the current date /time , such that the job runs on demand after an hour. But when I execute with the suggested script it is working fine for AM timings only

Not sure why

Regards,
Manoj

JenniferRah
Mega Sage

I am having the same issue. Did you ever find a resolution to this?