0

In the UK, we have GMT (Greenwhich Mean Time) for half the year and then we put the clocks forward by an hour to BST (British Summer Time) for the other half of the year.

How can I handle this issue within Joomla? Currently all of my modified dates in my component are incorrect by an hour. I know Joomla! bases it on the server time, so I guess I could speak to my host.

Is there a way to handle this otherwise?

In response to Hugh's comment, my Joomla configuration settings are set to London, and it has always been, so I don't think this is the reason.

7
  • You can set the timezone in your .htaccess file. For details, see: stackoverflow.com/a/33157095 Apr 29, 2021 at 10:05
  • Eoin, have you set the timezone of your website in Joomla's global configuration under 'server' settings? By default you will have UTC which would explain the results you are getting.
    – Hugh
    Apr 29, 2021 at 12:37
  • 1
    use Joomla\CMS\Date\Date; then $date = new Date('now', 'Europe/London');. Does that work?
    – Lodder
    Apr 29, 2021 at 13:31
  • But it's set in the global config. Or does that not matter because the server could be wrong? In which case is it simply a fact of telling the host to fix this stuff?
    – Eoin
    Apr 29, 2021 at 16:37
  • 1
    Joomla always stores the date/DateTime in UTC. It uses the selected timezone while displaying the dates. Which code are you using to display the dates? Are you having the same problem also in core Joomla Articles?
    – Jumbo
    May 31, 2021 at 6:59

1 Answer 1

0

There are a number of ways of doing this then, it does depend a lot on how the server is setup, but if you have access to the .htaccess file in your public_html folder (where Joomla is installed) you could add the following line:

php_value date.timezone 'Europe/London'

I would recommend creating a file called phpinfo.php (delete it afterwards) which contains

<?php
phpinfo();

If you search this file for date.timezone it will tell you what the local and server values are.

5
  • It looks like you haven't yet taken our tour, Hugh. Stack Exchange sites are not conversational forums, the posts on each page are either the original poster's question or a question-resolving answer. If you have questions to pose to the asker or relevant insights which will be helpful to the asker/researchers, these should be written as comments under the question. You do not yet have the privilege to comment, so I am going to convert your other answer to be a comment under the question because it asks for clarification and does not resolve the question. May 1, 2021 at 2:21
  • Thanks @hugh and welcome to JSE. I have spoken to my host and the date/time is correct, so I'm a little confused.
    – Eoin
    May 11, 2021 at 8:54
  • Nope, still not working with php_value either
    – Eoin
    May 19, 2021 at 14:53
  • PHP info says Default timezone Europe/London
    – Eoin
    May 19, 2021 at 14:55
  • Although I was about to point out that most of this stuff is available in Joomla system info without the need for PHP info. BUT when I did I spotted. Default timezone UTC so it's Joomla not server related.
    – Eoin
    May 19, 2021 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.