Solved

AM/PM %p not showing in Joomla 1.5.9

Posted on 2009-05-09
3
664 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
ID: 24346115
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
ID: 24355075
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
ID: 24359127
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

829 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