I need your help and assist, my database in phpmyadmin time is not right.
The time is 6 hours in minus. I am from EU Republic of Croatia.
I try date_default_timezone_set(‘Europe/Zagreb’); in my php code and change in Alter PHP Config menu in the control panel, but nothing change still the time is 6+ hours in phpmyadmin I set to DATETIME.
You can set the time zone for PHP using either of the methods you tried. However, note that those only set the timezone for PHP on that specific website.
Setting the PHP timezone doesn’t change the database timezone. The database timezone is governed by the system time of the database server. This time cannot be set for individual databases or users.
So when working with time, make sure to always use the web server time from PHP. Don’t use the time from the database server using functions like NOW() in the query. Instead, generate specific timestamps from your PHP code.
I want to show users the time from database
You say this is not possible to change, even with the php code on my website?
Simply just want to show members the registration date “24.02.2021 01:32” but the time is always -6 h what is the real time on the server, I understand that!
Do I have some option?
Yes. You can do what I told you to do in my previous message:
I don’t know what you’re doing exactly in your site, but if your times are off, then you’re not doing what I told you to do.
So just generate the registration date in PHP and store it in the database. The database server time doesn’t matter unless you you let the database generate dates for you. Which you shouldn’t do - you should do that through PHP code.
If you don’t understand what I mean, or you say you already did this, can you please share the following:
How and where did you set the timezone for PHP.
A code snippet showing how you store the registration date in the database.
A code snippet showing how you retrieve and show the registration date from the database.