How to show local time (instead of UTC) in events-list?
- danielmalaga
- Posts: 15
- Joined: Sun Nov 07, 2021 12:09 pm
- Location: Málaga, Spain
- Contact:
How to show local time (instead of UTC) in events-list?
Hi,
All videos are saved with the correct local time (UTC+2.00), also the inserted time in the snapshot pictures show the correct local time, but in the events list start/end-time show UTC time.
Where/how do I set that the local times are displayed?
(
ZM-options TIMEZONE is set to "(GMT+02:00) Europe, Madrid"; MySQL timezone is set the same
as said, ZM obviously knows the local time as it inserts the correct local time into snapshot images
I think it must be a display setting have I missed
)
Can you hint me in the right direction?
Thanks!
All videos are saved with the correct local time (UTC+2.00), also the inserted time in the snapshot pictures show the correct local time, but in the events list start/end-time show UTC time.
Where/how do I set that the local times are displayed?
(
ZM-options TIMEZONE is set to "(GMT+02:00) Europe, Madrid"; MySQL timezone is set the same
as said, ZM obviously knows the local time as it inserts the correct local time into snapshot images
I think it must be a display setting have I missed
)
Can you hint me in the right direction?
Thanks!
Re: How to show local time (instead of UTC) in events-list?
Best way to fix this is to add the timezone to php.ini
This example is for Debian 12
Add timezone to PHP (This may not be necessary but does not hurt and will allow the time of events to be displayed correctly)
nano /etc/php/8.2/apache2/php.ini
Search for [Date] (Ctrl + w then type Date and press Enter) and make changes as follows for your time zone
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = America/New_York
Ctrl+o Enter to save
CTRL+x to exit
Restart Apache
service apache2 restart
This example is for Debian 12
Add timezone to PHP (This may not be necessary but does not hurt and will allow the time of events to be displayed correctly)
nano /etc/php/8.2/apache2/php.ini
Search for [Date] (Ctrl + w then type Date and press Enter) and make changes as follows for your time zone
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = America/New_York
Ctrl+o Enter to save
CTRL+x to exit
Restart Apache
service apache2 restart
- danielmalaga
- Posts: 15
- Joined: Sun Nov 07, 2021 12:09 pm
- Location: Málaga, Spain
- Contact:
Re: How to show local time (instead of UTC) in events-list?
SOLVED.
Thank you very much, bbunge!
Changing date.timezone in php.ini did the trick. Times are now displayed in my local time.
Thank you very much, bbunge!
Changing date.timezone in php.ini did the trick. Times are now displayed in my local time.
-
- Posts: 1370
- Joined: Sat Aug 31, 2019 7:35 am
- Location: San Diego
Re: How to show local time (instead of UTC) in events-list?
Curious -
Did you not get a prompt at (initial) setup time to set Options->System->TIMEZONE?
Did you not get a prompt at (initial) setup time to set Options->System->TIMEZONE?
- danielmalaga
- Posts: 15
- Joined: Sun Nov 07, 2021 12:09 pm
- Location: Málaga, Spain
- Contact:
Re: How to show local time (instead of UTC) in events-list?
I am not sure if there was a prompt or if I set it up according to my old setup on my last install on another machine.
Anyway, Options->System->TIMEZONE is/was set correct, and this was not the problem. The problem was that in php.ini date.timezone was set to 'UTC' instead of 'Europe/Madrid' (in my case)
Anyway, Options->System->TIMEZONE is/was set correct, and this was not the problem. The problem was that in php.ini date.timezone was set to 'UTC' instead of 'Europe/Madrid' (in my case)
-
- Posts: 1370
- Joined: Sat Aug 31, 2019 7:35 am
- Location: San Diego
Re: How to show local time (instead of UTC) in events-list?
Interesting.
Thanks.
Thanks.
Re: How to show local time (instead of UTC) in events-list?
Thank you, it worked for me too (currently using Zoneminder 1.36.35 under Debian 12-bookworm as well).
For those who - like me - might miss the final lines of the solution message, don't forget to restart apache2 for the change to take effect, for example like this:
For those who - like me - might miss the final lines of the solution message, don't forget to restart apache2 for the change to take effect, for example like this:
Code: Select all
sudo systemctl restart apache2
Re: How to show local time (instead of UTC) in events-list?
Just had to do a clean install as I'd been negligent in upgrading my base OS and it did bad things to itself
ZM V.1.36.35 on brandie new install of Fedora 42 Server - nothing else installed or running on that box
Local time zone was set on install, all events are displayed with UTC time stamps, while the in image 'timestamp' is local.
Just did set the timezone in php.ini and restarted apache and zoneminder.
Very next event a few minutes after restart showed as UTC in the event display with no change to the in image timestamp.
Looking for more suggestions on getting local time in the event window instead of UTC.
Note OS is set to local timezone as well
ZM V.1.36.35 on brandie new install of Fedora 42 Server - nothing else installed or running on that box
Local time zone was set on install, all events are displayed with UTC time stamps, while the in image 'timestamp' is local.
Just did set the timezone in php.ini and restarted apache and zoneminder.
Very next event a few minutes after restart showed as UTC in the event display with no change to the in image timestamp.
Looking for more suggestions on getting local time in the event window instead of UTC.
Note OS is set to local timezone as well
Code: Select all
# timedatectl
Local time: Tue 2025-05-06 13:15:18 MDT
Universal time: Tue 2025-05-06 19:15:18 UTC
RTC time: Tue 2025-05-06 19:15:18
Time zone: America/Denver (MDT, -0600)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
Re: How to show local time (instead of UTC) in events-list?
I've also imported the zone data directory into Mariadb as outlined here: https://mariadb.com/kb/en/mariadb-tzinfo-to-sql/
I used
Then I set the Mariadb timezone using
(using the SET GLOBAL will not persist with a MariaDB restart - have to do a config file for that. Didn't bother for testing here)
Result
Then restarted apache and zoneminder
No change on the UTC vs local timestamps in the event window and correct timestamps in the event images themselves.
I used
Code: Select all
mariadb-tzinfo-to-sql /usr/share/zoneinfo | mariadb -u root mysql
Code: Select all
SET GLOBAL time_zone = 'America/Denver';
Result
Code: Select all
MariaDB [(none)]> SHOW GLOBAL Variables LIKE 'time_zone';
+---------------+----------------+
| Variable_name | Value |
+---------------+----------------+
| time_zone | America/Denver |
+---------------+----------------+
1 row in set (0.001 sec)
No change on the UTC vs local timestamps in the event window and correct timestamps in the event images themselves.
Re: How to show local time (instead of UTC) in events-list?
Had a power outage - again, my fault for not using a large enough UPS - but now, all the event times are showing MDT instead of UTC. So, seems the whole thing DOES need a re-boot to implement what I'd read to do, and then did, to correct things. Not just restart apache and zoneminder, but reboot the whole box. It's good now.