Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Issue setting date time from script

Community Alums
Not applicable

Hi, 

 

I want to set the schedule import start time from background. I am running a script to set the it adding 1 minute to current time. Here is the script:

var data_source=gs.getProperty('sourcing.sched.import.set');
var gr=new GlideRecord('scheduled_import_set');
gr.get(data_source);
var gdtRunTime = new GlideDateTime(gs.nowDateTime());
gdtRunTime.addSeconds(60);
gr.active=true;
gr.run_start=gdtRunTime.getValue();
gr.update();
 
The issue it is causing that, I am in India and my time zone is set to US/Central. So when I set the time around mid night, lets say current time is 11/19/2024 11:23:26 but it is setting to 11/19/2024 11:53:26 AM (which is 12 hours ago, which as per time zone should be PM), so the schedule never runs. 
 
Did I miss something to set here in script. 
Quick response will be appreciated 
0 REPLIES 0