CloudCode tasks always run in the UTC timezone, even if the scheduler for the task is configured with a different timezone. This is specifically relevant if performing time manipulations on the Date object.

It is possible to override the timezone by setting the process.env.TZ variable. Note that this must be assigned before any Date object is constructed, and cannot be changed again afterwards.

process.env.TZ = 'US/Central';

export async function run() {
    console.log('NOW:', Date.now(), new Date());

Last updated