Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What timezone is Heroku server using?

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

like image 297
xheyhenry Avatar asked Nov 30 '15 09:11

xheyhenry


People also ask

What is the server timezone?

UTC time is the standardized time used by most computers and servers around the world.

What time zone does Dyno bot use?

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.


2 Answers

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.

like image 166
Elon Gated Avatar answered Oct 24 '22 19:10

Elon Gated


Heroku is UTC by default. Open your app in heroku and go to app setting and click on Reveal Config Vars as in image enter image description here

and you have to add var as in image

enter image description here

TZ=Asia/kolkata

Then it will work fine for INDIA time zone. you can choose your time zone from time-zone-list.

like image 30
Ankit Singh Avatar answered Oct 24 '22 21:10

Ankit Singh