[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

Time is off by +5 hours on Joomla front end...but correct on backend.

Weird problem here.

Got a message saying that the website is displaying a time that's exactly 5 hours ahead of our current time, but when I check the administration side, it's the correct time.

For example:

Front side of site says: 14:00:00
Back side of site says:  09:00:00

Code for front side and back side is:
 
<?php

$date = date('H:i:s');

echo $date;

?>

Open in new window


The timezone is set to 'America/Chicago' which is my timezone  (CST), but I don't think it's working correctly...

This was working just find yesterday...and the only thing I changed was to enable Akeeba's Lazy Backup Plugin...disabled it now and still the same results.
0
Andrew Derse
Asked:
Andrew Derse
  • 2
1 Solution
 
Ray PaseurCommented:
Check out this article about time and localization.  I am sure you will find the answer!
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html
0
 
Andrew DerseIT ManagerAuthor Commented:
Changed my scripts from:

<?php return date("H")+01;?>

to

<?php return date("H")+1;?>

This worked like a charm...thanks Ray!
0
 
Ray PaseurCommented:
Glad to help, thanks for the points.  You might also consider date_default_timezone_set(), too.
http://php.net/manual/en/function.date-default-timezone-set.php
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now