Advertisement

Changed directly in MySQL publish_up field for a module shows VERY wrong time

General questions relating to Joomla! 3.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Post Reply
Sarge_2022
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Wed Jul 13, 2022 3:49 pm

Changed directly in MySQL publish_up field for a module shows VERY wrong time

Post by Sarge_2022 » Wed Sep 25, 2024 7:20 pm

Hello to Community !
I hope many of us agree that Joomla 3.9 still works very well and sometimes not so easy to upgrade because requires serious migration - due to that I'm still at J 3.9.
I've met a problem what is extremely strange for my understanding.
Environment - Almalinux 9, Joomla 3.9, PHP 7.4.33, Apache, MySQL 8.0
PROBLEM DESCRIPTION
1) As always - check Joomla site settings Website Zone - "America/Chicago"
2) Create Joomla article and check using native Joomla PHP code inside article
$created_time = JFactory::getDate('now', 'America/Chicago')->toSql();
echo "$created_time";
= 2024-09-25 13:40:39
3) check PHP server time at the same article
echo '<b> PHP server time ' . date('Y-m-d H:i:s') . '</b><br>';
= 2024-09-25 13:40:39
4) check general server shell time
Wed Sep 25 01:40:47 PM CDT 2024
5) check MySQL time
mysql -uroot -e 'SELECT NOW()'
= 2024-09-25 13:40:58
SO - EVERYTHING POSSIBLE WAY shows the SAME current Chicago time EVERYWHERE (no mention seconds difference between the commands performed)
---------------------
Now let's set directly using server shell command
1) mysql -uroot -N -e 'UPDATE joomla.apncl_modules SET publish_up = NOW() WHERE id=238' ;
2) check result
mysql -uroot -e 'SELECT publish_up FROM joomla.apncl_modules WHERE id=238' ;
= 2024-09-25 13:41:12
3) FINALLY - open Module with id = 238 from Administrator backend interface and see "Start Publishing"
!!!??? = 2024-09-25 08:41:32

WHY Administrator backend interface shows (and use) completely WRONG datetime ?
No joking - why Module Admin interface do not use direct correct datetime from according MySQL field ?
Is it possible somewhere to fix this abnormal "time playing", may be directly changing a code or setting inside Joomla PHP files ?
I suppose it could be inside /libraries/src/Date/Date.php - but can't catch what and how to change.

Would be very obliged to Community for any idea to try,
Regards,
Serge

Advertisement
User avatar
pe7er
Joomla! Master
Joomla! Master
Posts: 25188
Joined: Thu Aug 18, 2005 8:55 pm
Location: Nijmegen, Netherlands
Contact:

Re: Changed directly in MySQL publish_up field for a module shows VERY wrong time

Post by pe7er » Mon Sep 30, 2024 10:21 am

In the Joomla database times are stored at UTC time.
In the back-end the Time Zone is used to display the corrected time for your time zone for all users.
However, in each User Account, you can override the time zone for that specific user.

Not sure what is going wrong with your site.
Is it possible to upgrade to the latest version in the Joomla 3 series, which is Joomla 3.10.12, and test again?
Kind Regards,
Peter Martin, Global Moderator
Company website: https://db8.nl/en/ - Joomla specialist, Nijmegen, Netherlands
The best website: https://the-best-website.com

Sarge_2022
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Wed Jul 13, 2022 3:49 pm

Re: Changed directly in MySQL publish_up field for a module shows VERY wrong time

Post by Sarge_2022 » Tue Oct 01, 2024 7:12 pm

Hello Peter,
thank you for your answer and sorry for delay with reply.
1) My version is 3.9.28 Stable and sorry, I can't upgrade
2) All users time including Server Admin has a "default" time settings, I was testing changing time there - did not help.
But it seems I found a solution although "by blind testing" - may be will help to somebody.
I've supposed it's associated with Calendar and found files containing "UTC" using inner server search.
When I've changed all 'UTC" to 'America/Chicago' in files
/libraries/fof/form/field/calendar.php
/libraries/joomla/form/fields/calendar.php
- now I see correct time, I mean if I set
mysql -uroot -N -e 'UPDATE joomla.apncl_modules SET publish_up = NOW() WHERE id=238' ;
and then open Module with id = 238 from Administrator backend interface
-> I see "Start Publishing" time exactly as general server time, PHP time, MySQL time etc
mysql -uroot -e 'SELECT NOW()'
***
IMHO - I did not tested yet Joomla 5.x but it seems Joomla time should be much more controlled by SuperAdmin.
If I say, for example, "America/Chicago" in global config - it should be everywhere without the "hidden UTC" somewhere.
Well (if allowed) let's user set his own time for himself for his own user's interface ONLY - but should not be any "ambiguities" for system settings.
***
Thank you for your attention !
Kind Regards,
Serge

Advertisement

Post Reply

Return to “General Questions/New to Joomla! 3.x”