Time formatting for US

Support for the WordPress Calendar plugin
AdrienneA
Posts: 1
Joined: Tue Jun 17, 2008 12:07 am

Time formatting for US

Unread post by AdrienneA » Tue Jun 17, 2008 12:24 am

Greetings,

I've just started using your calendar plugin, thank you so much!

In the US the 24-hour format isn't used as much as elsewhere and can be a bit confusing for some. I changed the calendar.php code as follows, and perhaps some of your users can take advantage of this quick hack:

Change admin time format on lines 518 & 523-- current format is:

Code: Select all

echo date("H:i ")
Change calendar display time on line 1300-- current format is:

Code: Select all

date("H:i ", strtotime($event->event_time))


To change to 12-hour format with am/pm use:

Code: Select all

g:i a
(lowercase am/pm) or:

Code: Select all

g:i A 
(uppercase AM/PM)

Regards,

Adrienne Adams

User avatar
Kieran
Posts: 2059
Joined: Sat May 26, 2007 1:55 pm
Location: London
Contact:

Re: Time formatting for US

Unread post by Kieran » Wed Jun 18, 2008 9:49 am

This would, I believe, be a bad idea as the 24 hour format is that which is expected by the back-end database. Changing this in the admin panel might result in the desired diaply but would probably result in events either not saving or not saving with the right time.

You should feel free to do such a hack with the way times are displayed on the mouse-overs.

It is also worth noting that times in the mouse-overs will conform to the setting in WordPress for the time format in the next beta release.

DFLiddle
Posts: 2
Joined: Sun Jun 29, 2008 9:59 pm
Location: Dallas, TX
Contact:

Re: Time formatting for US

Unread post by DFLiddle » Sun Jun 29, 2008 10:54 pm

Just a note, really: I tried out this hack on our personal site, which also has the Upcoming Events widget active. (It's a copy of the plugin, with the modification.) The widget continues to display the 24-hour format. Is that an indication that all is still well on the server side?

User avatar
Kieran
Posts: 2059
Joined: Sat May 26, 2007 1:55 pm
Location: London
Contact:

Re: Time formatting for US

Unread post by Kieran » Mon Jun 30, 2008 2:19 am

The hack above is wrong, pure and simple. It only changes the display inside the admin panel, not on the publicly viewable areas of the site.

Post Reply