What timezone is Heroku server using? - heroku

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

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.

Heroku is UTC by default. You can change it by setting an env var to TZ=America/New_York or whatever, but I highly recommend you don't.
It's really good practice to keep all your server stuff (Heroku, CMS, etc.) in sync at UTC, and to only change this when displaying times clientside with something like Luxon.
Keeping this stuff in sync will save you a lot of headaches.

According to this, Heroku Help Log, you can change it with TZ variable. However, this never changes your log times, as they are always UTC.

Related

Why Are Heroku Logs Timestamped UTC After Setting TZ Environment Variable To Another Time Zone?

After following the procedure noted in this answer to change server time zone for a dyno the timestamp was still showing UTC using the command heroku log --tail or viewing logs on the application dashboard.
For example a Heroku contributor was trying to set IST via TZ="Asia/Kolkata, and I have done the same using TZ=America/New_York. However the timestamp in the log remains UTC regardless of the time zone chosen in the TZ environment variable.
As documented here, the TZ environment variable will not affect logs. Heroku logs are always timestamped in UTC.

heroku moment() js unix timestamp is incorrect

I have an issue on a Heroku server. Saving a unix timestamp to my DB using moment.js on my local server functions correctly. However on Heroku the timestamp is 23 hours behind, rounded down to the nearest hour.
dateProvided = Number(moment($('#dateProvided').val(), 'DD/MM/YYYY').unix())
The value provided by $('#dateProvided').val() is "12/08/2017". The unix timestamp for both the local and Heroku server is "1502492400" which is "08/11/2017 # 11:00pm (UTC)" when converting.
Return value
When I want the value that has been saved the code is:
moment.unix(dateProvided).format('DD/MM/YYYY')
Browser
The code above returns the correct date "12/08/2017" on the browser.
Heroku server
The code above returns the incorrect date "11/08/2017" on the Heroku server.
The issue was my local timezone was being used as the unix timestamp and Heroku is on UTC timezone. Therefore when saving Heroku was differing. The solution is:
moment.utc(value, 'DD/MM/YYYY').unix()
This ensures the timezone is the same as Heroku when saving a timestamp.
Use the module moment-timezone as this handles all types of timezones around the world. It fixed my problem with Heroku date/times.
Example:
const date = moment().tz('Europe/London').format('DD/MM/YYYY');
Further info: https://momentjs.com/timezone/

SonarQube: is it possible to change the time zone in the JVM parameters?

I have a machine that runs several different servers and it's in a specific time zone in Central Europe.
I need to run SonarQube (4.5.7) in UTC time.
I uncommented the following line in web/WEB-INF/config/environment.rb and restarted SonarQube but the server still shows the original time zone on the System Info page.
config.time_zone = 'UTC'
Should that be enough to change the time zone in SonarQube? Because that didn't really work.
Is there a way I can pass the user.timezone property to the JVM by editing the wrapper.conf file? Looks like it could work but it doesn't look like I'm supposed to touch that file.
Thanks.
Internal files, including web/**/*, must not be touched.
To change JVM timezone, you should edit conf/sonar.properties and add the value -Duser.timezone=Europe/Sofia to properties sonar.web.javaAdditionalOpts, sonar.ce.javaAdditionalOpts and sonar.search.javaAdditionalOpts.

Configure date and timezone in Ruby

I using some side api on my server what written in Ruby, and I found problem that timezone in Ruby app is different from my (on server sets proper timezone), I try to find solution how to configure it (like in php.ini) but I only getting results to set it in code. Can somebody tell me can I configure it like in PHP, e.g. in some ruby.ini file? Thanks!
Ruby gets the time zone information from the host's operating system. So you can either:
Change the time zone on your OS, or
Set the TZ environment variable. Eg.
ENV['TZ'] = 'US/Eastern'
source

Can I change time zone of ArangoDB's logs?

I live in Japan, so wanna change time zone of ArangoDB's logs from default to UTC+9:00.
Maybe I have to change somewhere of config files but I couldn't make sense.
The time zone is always GMT. You could open a feature request on github https://github.com/triAGENS/ArangoDB/issues maybe a config option can be added. But this needs to be checked.

Resources