Date on the console view

Anything you want added or changed in future versions of ZoneMinder? Post here and there's a chance it will get in! Search to make sure it hasn't already been requested.
Post Reply
KorayPeksayar
Posts: 12
Joined: Fri Nov 11, 2005 11:35 pm
Location: Istanbul/Turkiye
Contact:

Date on the console view

Post by KorayPeksayar »

Hello,
The date on the console view remains in British English despite of locale change.

This should be fixed in tis way:
Line 207 of the file zm_html_view_console.php should be changed as

Code: Select all

<td class="smallhead" align="left"><?= strftime( "%a %d %B, %I:%M %p"); ?></td>
The original line has the date statement. However date statements are not parsed for locale translation by PHP. Instead strftime() should be used.

Regards,
Koray
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Yes, you'll find date used extensively as it's a lot more flexible and has better options than strftime. However, as you have noticed, it isn't particularly locale friendly. I suspect that migration to full internationalisation is going to involve backwards steps in a number of areas unfortunately.

Phil
KorayPeksayar
Posts: 12
Joined: Fri Nov 11, 2005 11:35 pm
Location: Istanbul/Turkiye
Contact:

Post by KorayPeksayar »

Phil, no. This is only for the displaying of the date, not for manipulating or db operations.

I have changed the code this way and it is good now :)

More to come :)

Koray
KorayPeksayar
Posts: 12
Joined: Fri Nov 11, 2005 11:35 pm
Location: Istanbul/Turkiye
Contact:

Post by KorayPeksayar »

I forgot sth.

Both date and strftime work on UN*X timestamps.
You have used UN*X timestamps in the code for db operations and so any other formatting string with strftime would work in the meaning of date and time display.

Koray
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Unfortunately strftime neither does ordinals (e.g. 15th, 2nd, 3rd etc) or provides the facility to output hours etc as just single digits (where appropriate) not prefixed by spaces or zeroes.

So currently there are 43 instances of 'date' and only 22 of 'strftime' in the web interface. To be honest strftime is, and always has been, a nasty function and after years of struggling with it I was mightly relieved to come across date and it's more flexible options. So I generally use it exclusively except for the odd occasion where strftime was required. In general this means I use date for human readable date/times and strftime where fixed width set formats are required for database interaction etc but aside from the locale issues I think I could probably convert most of those calls to date.

Phil
Post Reply