Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 674
  • Last Modified:

AM/PM %p not showing in Joomla 1.5.9

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
gguzman
Asked:
gguzman
  • 2
1 Solution
 
tg_wilkCommented:
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
 
gguzmanAuthor Commented:
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
 
tg_wilkCommented:
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now