Solved

AM/PM %p not showing in Joomla 1.5.9

Posted on 2009-05-09
3
666 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Knowledge base software has turned out to be a quite reliable method for storing information, promoting collaborative work and for sharing valuable input and solutions.However, some organizations are trying to develop a knowledge base that works wit…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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.

717 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