I want to modify the date of a scheduled job run to a local date and set it in a table.

M_Tomy
Tera Expert

Dear Experts

 

Please tell me.
I want to modify the date when a schedule job is executed to a local date and set it to an item in a given table.
How can I implement this?

 

Thank you very much.

3 REPLIES 3

SatyakiBose
Mega Sage

Hello @M_Tomy 

What are you referring to as local date?

Is it your local timezone?

And what are you referring to as item?

Please provide the complete business use case.

Dear @SatyakiBose 

 

Thank you for your prompt reply.

 

I would like to get the date retrieved in GMT with my local date (JST).

 

▼ Use Case
For the convenience of creating a report, I have a job to create dummy data for each quarter.
I want to have the job's execution date (JST) set for the date field of the dummy data records.
If I use GMT, the date may be different from my local date depending on the time of the day.
I want to get the date for my region because it will affect the aggregate results of the report.



By the way, I had written the following code but the return value was strange.

 

▼ Script
var run_date = (new GlideDateTime()).getLocalTime().getByFormat('YYYY-MM-DD');
gs.info(run_date);

 

▼ Log
1970-01-44

 

Best regards.

Hello @M_Tomy 

So if I am correct, you wish to run a scheduled job at JST only.

For this, you can add the field Run as tz on the form. This field is there on the table, but not added on the form. You will have to customize the form and add it.

Here you can select your specific timezone to run the script.

Please check the KB article here:

Timezones and Scheduled Reports - Support and Troubleshooting - Now Support Portal.

 

 

If my answer has helped you, please mark this as solution