[wp-hackers] Changing the clock format in Write > Post

Jason Webster jason at intraffic.net
Sun May 4 19:22:58 GMT 2008


That seems sane to me.

$time_in_12hr =  date("g:i a", strtotime($time_in_24hr));

$time_in_24hr =  date("H:i", strtotime($time_in_12hr));

You could use mktime(), but as an example, this works.

Charles E. Frees-Melvin wrote:
> Why not leave it 24h and allow entry of "17" "5p" or "5pm"? And have
> it autoconvert.
>
> On 5/4/08, Alexander Beutl <xel at netgra.de> wrote:
>   
>>> So what do you all think at this point? Ozh made a suggestion on the
>>> trac ticket that I really liked, making this a global option that can
>>> be overridden by a user if so desired. It seems like a more elegant
>>> way of doing this, but I'm not sure if I really understand the way the
>>> logic would need to change to support that. Aside from less records in
>>> the db, what other advantages would doing this have?
>>>       
>> That if you create a US blog with ~20 Bloggers not everyone will have to
>> reset the radiobutton just because they all want the 12h format.
>>
>>
>>     
>>> The code would remain the same for the most part, and maybe even slightly
>>> more
>>> complicated (this is an assumption, I imagine that coding for a new
>>> global option + per user overrides would be more involved than a
>>> single user option, correct me if I'm wrong :) )
>>>       
>> somewhat like
>>
>> if( $user_setting == '12h' || ($user_setting == 'use_default' &&
>> $default_setting == '12h')) {
>>   // 12h code
>> } else {
>>   // 24h code
>> }
>>
>> don't know if you want an additional OR condition with 2 AND-combined
>> conditions complicated - choose yourselfe.
>>
>> Per User setting would be an selection list with
>> -- use blog default
>> -- 24h format
>> -- 12h format
>>
>> Global Setting would only need a checkbox with 'use 12h time format' or a
>> radio button group with both 24h and 12h.
>>
>> I'd also point out that even though some of us
>>     
>>> find it easy to read/set a 24-hour clock, pretty much EVERYONE knows
>>> how to read/set a 12-hour clock.
>>>       
>> For most people normally handling 24h format it will be no problem to say 15
>> = 3 BUT they will not have any idea what "am" and "pm" means. I learned it
>> in english lessons - but not everyone had english at school. And since there
>> are no abbr. for this in those languages there is no way to tell them (and
>> you can not use any self explaining stuff since there is no room for it)
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>>     
>
>   



More information about the wp-hackers mailing list