--> -->

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.

Setting the system timezone for cron tasks 

The 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 Europe/Paris or 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.

Setting an application runtime timezone 

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.
  • Java runtime - You can change the timezone by starting the server with env TZ='<timezone>' java -jar .... An alternative to setting an environment variable is setting the JVM argument user.timezone. This JVM argument takes precedence over the environment variable TZ. For example, you can use the flag -D when running the application: java -jar -Duser.timezone=GMT or java -jar -Duser.timezone="Asia/Kolkata"

Setting the application timezone will only affect the application itself, not system operations such as log files.