Date Format differs
Date Format differs
Fedora 34
Zoneminder 1.36.11
System Locale: LANG=en_US.UTF-8
Timezone GMT-6:00
US installation, however In the event list it shows date start time and end time in GB format. Is there a setting in ZM to change this?
I have monitor timestamp set to %m/%d/%y
Zoneminder 1.36.11
System Locale: LANG=en_US.UTF-8
Timezone GMT-6:00
US installation, however In the event list it shows date start time and end time in GB format. Is there a setting in ZM to change this?
I have monitor timestamp set to %m/%d/%y
Re: Date Format differs
I have the same issue: event start/end times are displayed in dd/mm/yy format rather than the typical (for the US) mm/dd/yy format.
--Larry
- Options > System > TIMEZONE is set to (GMT-6:00) America, Chicago
- php.ini has date.timezone = America/Chicago
- Zoneminder server and database server are both set to America/Chicago
--Larry
Re: Date Format differs
You set the timestamp format under Monitor->Timestamp
Re: Date Format differs
Sorry, I'm referring to the events display on the web interface, the monitor date format seems to have no impact upon this:
Any chance this is related to the 1.36.11 change:
- Set Locale for time to en_GB.utf8, changed STRF_FMT_DATETIME_SHORTER to %x which is locale aware short date
--Larry
Any chance this is related to the 1.36.11 change:
- Set Locale for time to en_GB.utf8, changed STRF_FMT_DATETIME_SHORTER to %x which is locale aware short date
--Larry
Re: Date Format differs
I wish I could get UK date formats here!
1.36.10 on CentOS.
e2a: Turns out I can
The clue was STRF_FMT_DATETIME_SHORTER above and the solution was to edit /usr/share/zoneminder/www/includes/lang.php and change the definition from '%m/%d %H:%M:%S' to '%d/%m %H:%M:%S'
I guess this might fix itself (at least for me) in 1.36.11 and higher, but I'm waiting for .12.
1.36.10 on CentOS.
e2a: Turns out I can
The clue was STRF_FMT_DATETIME_SHORTER above and the solution was to edit /usr/share/zoneminder/www/includes/lang.php and change the definition from '%m/%d %H:%M:%S' to '%d/%m %H:%M:%S'
I guess this might fix itself (at least for me) in 1.36.11 and higher, but I'm waiting for .12.
Re: Date Format differs
I am on 1.36.12 Focal and have the same issue...
Re: Date Format differs
I don't know the history of the codebase, but upon further investigation it appears odd to me that /usr/share/zoneminder/www/lang/en_us.php includes /usr/share/zoneminder/www/lang/en_gb.php which defines setlocale( LC_TIME, 'en_GB.utf8' ), but then does not update the locale to the US.
A simple fix, but one that probably won't survive updates is:
--Larry
A simple fix, but one that probably won't survive updates is:
Code: Select all
--- /usr/share/zoneminder/www/lang/en_us.php~ 2021-11-17 10:05:50.000000000 -0600
+++ /usr/share/zoneminder/www/lang/en_us.php 2021-12-23 06:41:10.854389147 -0600
@@ -69,6 +69,8 @@
// setlocale( LC_CTYPE, 'en_GB' ); Character class settings 4.3.0 and after
// setlocale( LC_TIME, 'en_GB' ); Date and time formatting 4.3.0 and after
+setlocale( LC_TIME, 'en_US.utf8' );
+
// Simple String Replacements
$SLANG['24BitColour'] = '24 bit color';
$SLANG['32BitColour'] = '32 bit color';
Re: Date Format differs
Thank you for posting your findings and the fix!
Re: Date Format differs
The language stuff could use a cleanup.
I'll get that setlocale into master and 1.36.13, but really more needs to be done.
Ideally the language would set a default, but then in config, and in User settings should be overrideable.
I wonder if we really even need to set a default. Should it use the system default?
I'll get that setlocale into master and 1.36.13, but really more needs to be done.
Ideally the language would set a default, but then in config, and in User settings should be overrideable.
I wonder if we really even need to set a default. Should it use the system default?
- AllenTuttle
- Posts: 30
- Joined: Tue Sep 25, 2007 4:56 pm
- Location: Sequim WA.
Re: Date Format differs
So, even if we have to edit after every update, is there a way to get the Date string in the various views to be Day/Month/Year?
I edited many of the php's changing %d/%m/%y to %y/%m/%d but none had any effect even after restarting httpd and zoneminder.
The only change that had any impact was adding "setlocale( LC_TIME, 'en_US.utf8' )" to en_us.php but all id did was change the year format from 2 digits to 4.
I edited many of the php's changing %d/%m/%y to %y/%m/%d but none had any effect even after restarting httpd and zoneminder.
The only change that had any impact was adding "setlocale( LC_TIME, 'en_US.utf8' )" to en_us.php but all id did was change the year format from 2 digits to 4.
Re: Date Format differs
I'm stuck in the d-m-y format too. Monitor>Timestamp shows %N - %y-%m-%d %H:%M:%S %z but doesn't effect event format.
I did have to fight with utf8mb4 vs utf8 a bit after a crash and frustrating rebuild.
Ubuntu 18.04.6 LTS, mysql Ver 15.1 Distrib 10.7.3-MariaDB, zoneminder v1.36.13
Language is en-us, Timezone is Los Angeles.
I did have to fight with utf8mb4 vs utf8 a bit after a crash and frustrating rebuild.
Ubuntu 18.04.6 LTS, mysql Ver 15.1 Distrib 10.7.3-MariaDB, zoneminder v1.36.13
Language is en-us, Timezone is Los Angeles.
Re: Date Format differs
Thanks, Larry, that fixes my frustration for the moment. Hopefully, an update doesn't bork it. As it is only on my local machine, I altered both /usr/share/zoneminder/www/lang/en_us.php and /usr/share/zoneminder/www/lang/en_gb.php to +setlocale( LC_TIME, 'en_US.utf8' );. I don't think there will be an issue with it being told twice to use the US date version (as /usr/share/zoneminder/www/lang/en_us.php calls for "require_once( 'lang/en_gb.php'").fahnoe wrote: ↑Thu Dec 23, 2021 1:09 pm I don't know the history of the codebase, but upon further investigation it appears odd to me that /usr/share/zoneminder/www/lang/en_us.php includes /usr/share/zoneminder/www/lang/en_gb.php which defines setlocale( LC_TIME, 'en_GB.utf8' ), but then does not update the locale to the US.
A simple fix, but one that probably won't survive updates is:
--LarryCode: Select all
--- /usr/share/zoneminder/www/lang/en_us.php~ 2021-11-17 10:05:50.000000000 -0600 +++ /usr/share/zoneminder/www/lang/en_us.php 2021-12-23 06:41:10.854389147 -0600 @@ -69,6 +69,8 @@ // setlocale( LC_CTYPE, 'en_GB' ); Character class settings 4.3.0 and after // setlocale( LC_TIME, 'en_GB' ); Date and time formatting 4.3.0 and after +setlocale( LC_TIME, 'en_US.utf8' ); + // Simple String Replacements $SLANG['24BitColour'] = '24 bit color'; $SLANG['32BitColour'] = '32 bit color';
Re: Date Format differs
I have the same issue. My change was to copy en_gb.php to en_us.php.new and change lines 72 & 74
Line 72: setlocale( LC_TIME, 'en_US.utf8' );
Line 74: define( "STRF_FMT_DATETIME_SHORT", "%m/%d/%Y %H:%M:%S" );
Then save with the .new so I can re-copy over to the en_us.php
Line 72: setlocale( LC_TIME, 'en_US.utf8' );
Line 74: define( "STRF_FMT_DATETIME_SHORT", "%m/%d/%Y %H:%M:%S" );
Then save with the .new so I can re-copy over to the en_us.php
Re: Date Format differs
Changing the definition of STRF_FMT_DATETIME_SHORTER in /usr/share/zoneminder/www/includes/lang.php from '%m/%d %H:%M:%S' to '%d/%m %H:%M:%S' worked to give me DD/MM instead of MM/DD in the event view, so maybe changing STRF_FMT_DATE in the same file to something other than '%x' would work (e.g. '%d/%m/%y %H:%M:%S').AllenTuttle wrote: ↑Thu Mar 03, 2022 12:07 am So, even if we have to edit after every update, is there a way to get the Date string in the various views to be Day/Month/Year?