What timezone does Heroku's servers use? I'm trying to use node-cron and have the timezones line up, but I can't understand what timezone Heroku is using. Here's an example.
2015-11-30T09:16:45.874086+00:00
UTC time is the standardized time used by most computers and servers around the world.
To change your dynos timezone you have to add a TZ environment variable to your application. Note: Changing your dynos timezone is not usually a good idea. Best practice would be to store/use time in UTC and instead convert the UTC time as appropriate at the view layer/client side for display only.
By default Heroku will return calls for current time in UTC.
You can manually set your app's time zone by adding a TZ environment variable via the config command. Keep in mind that you must use the tz database time zone format. For example, if you wanted to set your default time zone to US Central time you would use the following command (I'm assuming you have/use heroku toolbelt) :
heroku config:add TZ="America/Chicago"
EDIT: As treecoder points out in the comment below; the TZ
ENV variable can be added via the Heroku dashboard if you prefer. Open your app's dashboard and navigate to the 'settings' tab, then under 'config variables' click the 'reveal config vars' button. You will then be able to add TZ
= America/Chicago
(or whatever timezone you need).
NOTE: The TZ
environment variable does not affect logs. See the second note here.
Heroku is UTC by default. Open your app in heroku and go to app setting
and click on Reveal Config Vars
as in image
and you have to add var as in image
TZ=Asia/kolkata
Then it will work fine for INDIA time zone. you can choose your time zone from time-zone-list.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With