Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Incorrect Time Problem


iantates

Recommended Posts

My times within the website are incorrect, Is there a way of changing the time?

 

I am in the United Kingdom but I am using an American server so all the times for orders, visits etc is 5 hours behind the true time. I guess OsCommerce is pulling the time from the hosts server and not here in the UK.

 

Any ideas welcome.

Link to comment
Share on other sites

Hi

 

in the includes/languages/english.php (I assume it is english you are using ??)

 

Find the following

 

// on RedHat try 'en_US'

// on FreeBSD try 'en_US.ISO_8859-1'

// on Windows try 'en', or 'English'

@setlocale(LC_TIME, 'en_US.ISO_8859-1');

and replace it with:

 

// on RedHat try 'en_US'

// on FreeBSD try 'en_US.ISO_8859-1'

// on Windows try 'en', or 'English'

//@setlocale(LC_TIME, 'en_UK.ISO_8859-1');

@setlocale(LC_TIME, 'en_GB');

@PUTENV('TZ=Europe/London');

@mktime('0,0,0,1,1,1970');

 

Regards

 

PhilipH

Link to comment
Share on other sites

PhilipH

 

I have tried your suggestion and still no joy.

 

Having a look at the English.php in admin and catalog, do both of these need to be changed ?

 

The one in admin was showing time as US but even after I have replaced both files with the code you gave me it is still showing time 5 hours behind!

Link to comment
Share on other sites

Whilst trying to solve the time issue I found the following using Server Info

Server Information  

Server Host: host2.apollohosting.com (209.239.52.76)      Database Host: www.simplyfancydress.co.uk (64.176.109.2) 
Server OS: Linux 2.4.27      Database: MySQL 3.23.58 
Server Date: 11/08/2004 10:23:16      Datebase Date: 11/08/2004 05:23:16 
Server Up Time: 10:23am up 48 days, 11:42, 1 user, load average: 3.35, 2.77, 2.32 

HTTP Server: Apache/1.3.29 (Unix) ApacheJServ/1.1.2 PHP/4.3.4 mod_throttle/2.11 FrontPage/5.0.2.2634 Rewrit/1.1a 
PHP Version: 4.3.4 (Zend: 1.3.0)

 

It would seem the server is running at the correct time but the database is still 5 hours behind!

 

Is there any way to change this?

Link to comment
Share on other sites

I'm in exactly the same boat - I had assumed I would need to force some simple equation to 'subtract' some time from the values set in the database, but as you can probably tell from this explanation, I have no idea how to.

 

!

- drink tea.

Link to comment
Share on other sites

  • 4 months later...
I'm in exactly the same boat - I had assumed I would need to force some simple equation to 'subtract' some time from the values set in the database, but as you can probably tell from this explanation, I have no idea how to.

 

!

 

I know this is an old thread but I have the same problem.

 

I just noticed this problem as well. When my DB was on the same server as my site it was fine, but now my DB and server are on two different boxes and the DB is coming up 5 hours off. It's messing up my reports since the evening sales are showing as being done the next day :(

 

Did anyone solve this?

Link to comment
Share on other sites

Talk with your database server admin. Depending on the MySQL version, you may be able to reset the time_zone variable for your connection.

 

MySQL Reference Manual :: 5.8.8 MySQL Server Time Zone Support

 

http://dev.mysql.com/doc/mysql/en/time-zone-support.html

 

Beginning with MySQL 4.1.3, the server maintains several time zone settings:

 

* Per-connection time zones. Each client that connects has its own time zone setting, given by the session time_zone variable. Initially this is the same as the global time_zone variable, but can be reset with this statement:

 

mysql> SET time_zone = timezone;

 

The current values of the global and per-connection time zones can be retrieved like this:

 

mysql> SELECT @@global.time_zone, @@session.time_zone;

 

timezone values can be given as strings indicating an offset from UTC, such as '+10:00' or '-6:00'. If the time zone-related tables in the mysql database have been created and populated, you can also used named time zones, such as 'Europe/Helsinki', 'US/Eastern', or 'MET'. The value 'SYSTEM' indicates that the time zone should be the same as the system time zone. Time zone names are not case sensitive.

 

I'm no expert with this (my database is on my server), just reporting what I've read... :)

"Buy the ticket, take the ride..." -HST

Link to comment
Share on other sites

Talk with your database server admin. Depending on the MySQL version, you may be able to reset the time_zone variable for your connection.

 

MySQL Reference Manual :: 5.8.8 MySQL Server Time Zone Support

 

http://dev.mysql.com/doc/mysql/en/time-zone-support.html

I'm no expert with this (my database is on my server), just reporting what I've read... :)

 

Spoken with my server guy he insisted the mysql server was set to the correct time. It wasn't even until I read this post that I thought it could be oscommerce's problem.

 

I will ask my host about the above and see what they say. I hope this is the solution because it's messing up my bookkeeping :P

 

Thanks for the info, I really appreciate it.

Link to comment
Share on other sites

Unless you are running on a VPS or a Dedicated Server, it's going to be tough asking your foreign host to change your server time.

 

Keep in mind that osCommerce uses both PHP's (Apache or IIS) and MySQL's time. The 2 can be very different, depends on the physical machine they reside in.

 

Existing solutions (not entirely elegant):

http://www.oscommerce.com/forums/index.php?showtopic=76994&hl=

http://www.oscommerce.com/forums/index.php?showtopic=32920&hl=

 

But really, the best way is to get a Dedicated Server or a very affordable VPS. That way, you will get full control of the system time and timezone.

Link to comment
Share on other sites

The main problem was not knowing the server time (set correct) was being "timezoned", so to speak, by mysql. Once I knew that could be the problem it was just a matter of switching mysql to EST time zone on mysql. All problems fixed.

 

Thanks for pointing me in the right direction.

Link to comment
Share on other sites

  • 1 year later...
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...