All Platform.sh containers default to running in UTC time. Applications and application runtimes may elect to use a different timezone but the container itself runs in UTC. That includes the
spec parameter for cron tasks that are defined by the application.
That is generally fine but sometimes it's necessary to run cron tasks in a different timezone.
timezone property sets the timezone for which the
spec property of any cron tasks defined by the application will be interpreted. Its value is one of the tz database region codes such as
America/New_York. This key will apply to all cron tasks defined in that file.
This entry is only meaningful on cron specs that specify a particular time of day, rather than a "time past each hour". For example,
25 1 * * * would run every day at 1:25 am in the timezone specified.
The application runtime timezone can also be set, although the mechanism varies a bit by the runtime.
- PHP runtime - You can change the timezone by providing a custom php.ini.
- Node.js runtime - You can change the timezone by starting the server with
env TZ='<timezone>' node server.js.
- Python runtime - You can change the timezone by starting the server with
env TZ='<timezone>' python server.py.
Setting the application timezone will only affect the application itself, not system operations such as log files.
note In the vast majority of cases it's best to leave all timezones in UTC and store user data with an associated timezone instead.