News:

Looking for documentation? Take a look on our wiki

Main Menu

Time zone with a difference of 2 hours in the database

Started by Iryn3l, March 11, 2021, 11:11:28 AM

Previous topic - Next topic

Iryn3l

Hello

In the database virtuemart_orders` WHERE `order_number` LIKE '10032021-0003'
Credted_on >> 2021-03-10 15:00:11 (this is the wrong time)
Modified_on 2021-03-10 15:00:55 (this is the wrong time)

In viretuemart ORDERS i have
Wednesday, 10 March 2021 17:00 Created On (this is the right time)
Wednesday, March 10, 2021 17:00  Modified On (this is the right time)

In Joomla Location settings
Website Time Zone is set correctly.
The server time is set correctly (I talked to those  manage server  twice)
By e-mail, when they receive orders, their time is correct

Does anyone know what may be the cause of the wrong time in my database?
Thank You

----
Joomla! 3.9.20
VirtueMart 3.8.4 10335
PHP 7.3

Jörgen

AFAIK UTC timezone data is common practice to store in the database. Then You can compare ALL the data regardless of who made the order (different timezone). The user then gets the date translated to his local timezone. Storing data in local time will creata a mess an will get you into trouble sooner or later. Translate the UTC date to the local timezone and everything should work out.

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

Iryn3l

Thanks
I'm sorry but I don't quite understand
All my orders are made with from my country (same time zone), shouldn't I have the correct time in the database as well?

Translate the UTC date to the local timezone and everything should work out. >>>> I do not understand this

Tahnk you

AH

Joomla and VM will take your timezone into consideration if configured in admin.

The writing of the data created_on / modified_on and potentially other times for Joomla and VM  is based on what time your dbase is using on your server.

As you can see from your displays in Joomla and VM - the website is handling the differences correctly for display and printing etc.

Looking directly into the tables will show you an unconverted time - this may be that same time as you system - but it may not be.

Try this in your phpmyadmin and see what timezone mysql is using

SELECT @@system_time_zone;



Regards
A

Joomla 3.10.11
php 8.0