Solved

AM/PM %p not showing in Joomla 1.5.9

Posted on 2009-05-09
3
655 Views
Last Modified: 2012-05-06
I'm running a couple of sites with Joomla 1,5,9 and just can't get the AM PM %p code to work. I'm using the following date format:

%A %d de %B de %Y %l:%M %p

And I get:

Miércoles 22 de Abril de 2009 12:00

without the AM/PM.

If I run the following code outside Joomla on the same server it works:

<?php
setlocale(LC_ALL, 'es-ES');
echo strftime('%l:%M:%S %p', time());
?>

so I guess the server setting are correct. The locale in Joomla is set to es-ES.

The same thing happens in other Joomla components such as Eventlist.

Any ideas on how to show the AM/PM? Thanks!
0
Comment
Question by:gguzman
  • 2
3 Comments
 
LVL 7

Expert Comment

by:tg_wilk
Comment Utility
According to http://docs.joomla.org/How_do_you_change_the_date_format%3F

"(Note that %P will print the lowercase am/pm indicator for your locale, which may be blank.)"

It probably is blank for es-Es - it doesn't have much sense with 24 hour clock. Why would you want to show it?
0
 

Author Comment

by:gguzman
Comment Utility
I tested the es-ES locale in my server through the script I posted and %p is not empty, it shows the AM/PM format. Unless Joomla has another locale setting which may be empty.

I'm not using the 24 hr format, but the 12 hr with AM/PM.

Thanks!
0
 
LVL 7

Accepted Solution

by:
tg_wilk earned 250 total points
Comment Utility
According to ibm (http://publib.boulder.ibm.com/infocenter/wf/v2r7m0/topic/com.ibm.help.wf.doc/locale_spec/i_xfdl_r_locale_quick_reference.html) in es-ES locale time should be presented as follows:

time       numeric       H.mm       18.52
        short       H:mm       18:52
        medium       H:mm:ss       18:52:35

As you can see the time is presented in 24 hour format without am/pm. %p shows am/pm for your locale, which in your case is an empty string. If you want to display date in other format, change your locale accordingly - Bolivian spanish should have am/pm (es-BO).
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now