I have developed an application which is very (JodaTime) DateTime centric (calendar and so on). Locally at my computer all works fine. I have deployed my app at cloudfoundry and there no dates are visible in the calendar. I guess that this has something to do with the timezone of cloudfoundry. I have connected my locally running application to the mongodb database in the coud and everything works find. My question now would be how to change timezone at cloudfoundry to CEST (MEZ)?
Thanks a lot!
Your Java application is going to run in a Linux container, so you can use any Linux or Java method of setting the timezone.
The easy ones that come to mind...
cf set-env <app-name> TZ 'America/Los_Angeles' cf restage <app-name>
or
cf set-env <app-name> JAVA_OPTS '-Duser.timezone=Europe/Sofia' cf restage <app-name>
The first should be generic to any application that respects the TZ environment variable. The second is specific to Java.
If you don't want to use
cf set-env
you could alternatively set the environment variables via yourmanifest.yml
file.To expand on @DanielMikusa. (Great Answer)
SAMPLE MANIFEST:
WHY I KNOW IT WORKS:
Prints:
(Timezone) Local Hour: 23 UTC Hour: 23
If I set the manifest to have
TZ: America/Los_Angeles
It Prints:
(Timezone) Local Hour: 16 UTC Hour: 23