Setting timezone dynamically
matiniamirhossein opened this issue · 4 comments
matiniamirhossein commented
Hi there,
Is there a way to set timezone dynamically in crunz?
We read timezone from a php configuration file.
Thanks.
PabloKowalczyk commented
Hello,
currently you can set it per task using timezone
method.
With env vars support (#315) you can set it by env var, but event better will be to support PHP config file where you can do everything you want. WDYT?
Deleted user commented
@PabloKowalczyk I think its better if we can also do $schedule>timezone() at the beginning of each task file.
Also, thank you for your awesome library, saved me a big time.
vicphase commented
@PabloKowalczyk how can I invoice the timezone
method?
PabloKowalczyk commented
@vmartinez56 you can specify timezone per task:
<?php
use Crunz\Schedule;
$schedule = new Schedule();
$task = $schedule->run(PHP_BINARY, ['-v']);
$task
->everyMinute()
->timezone('Europe/Warsaw') // string or \DateTimeZone instance
;