How to Set the Timezone in Joomla?

Setting the timezone is one of the trickiest things to do on any website, and while Joomla makes this easy for its users, it can still be very tricky. Let us explain why…

Joomla allows the super administrator to change the website’s timezone in the configuration settings, by going to Site->Global Configuration->Server, and then changing the value next to Server Time Zone to his country/state/province of preference. See below:

Joomla Timezone

Figure 1: Changing the timezone on a Joomla website using Joomla’s interface

When doing the above, we will ensure that every page running under the Joomla environment displays (or can display) the timezone that we chose. However, there are some Joomla extensions (that do not integrate well with Joomla’s environment) that ignore this setting or do not use it (this typically happens when the extension does not require the Joomla environment in order to run). These extensions cause a problem and may lead to inconsistencies in displaying the time across the website.

There are four ways to solve the above problem:

  1. Fix the extension in order to use Joomla’s environment: This can easily be done by simple includes. However, it might lead to potential problems and conflicts when using the extension.
  2. Force the extension to use the timezone of your choice: If you don’t want to include the Joomla environment in the extension, or if you’re having problems including the Joomla environment, then you can easily set the timezone using the PHP function date_default_timezone_set. The downside for doing this is that you need to change the timezone in at least two places whenever you want to change it.

  3. Change the timezone on the server itself: On a Windows server, changing the timezone is pretty much straightforward. On the other hand, it can be a bit of a complicated process on Linux depending on your distribution. For example, some Linux distributions have tools that will allow you to easily change the timezone – while you need to jump through hoops to change the timezone on some other distributions. Usually this is a job for your system administrator. If you are on shared hosting, you need to ask your hosting company to do this – keep in mind, however, that your hosting company is most likely to refuse to do this since this change will affect all the clients and the services (such as email and cron jobs) hosted on the same server.

  4. Change the timezone in the .htaccess file: Few are those who know that the server timezone can be set at the website level in the .htaccess file. All one needs to do is to include the following line in his .htaccess file (of course, the America/California part needs to be changed to your timezone):

    SetEnv TZ America/California

    The nice about this method is that you don’t need to make a change anywhere else. Joomla will inherit this setting and any script running under your website will have this timezone. We think this is the best way to set the timezone on a Joomla website.

One final note: If you’re running cron jobs, then make sure you explicitly set the timezone in your scripts if you don’t want to use the default timezone of your server.

Now are you reading this post because you are having problems with timezones on your Joomla website? We definitely understand your frustration and we’re here to help. All you need to do is to contact us and we’ll take it from there! We are always excited to take on new projects, we are very friendly, and our rates are affordable!

2 Responses to “How to Set the Timezone in Joomla?”
  1. Comment by Chris Kramer — October 22, 2015 @ 3:31 am

    Hi,

    I have a server time issue with our app and need some help from someone who can probably solve it much faster than we can. I verified the global settings in Joomla, we set NTP sync and UTC-7. I have a scheduling tool that delivers content to connected social networks and it’s still off by over 5.5 hours, so I’m scratching my head.

  2. Comment by Fadi — October 22, 2015 @ 3:58 am

    Hi Chris,

    That scheduling tool that you’re using, is it running as a server cron? Is the time on your server correct?

    Could you please contact us so that we can help resolve your problem?

Leave a comment