?
Solved

AM/PM %p not showing in Joomla 1.5.9

Posted on 2009-05-09
3
Medium Priority
?
667 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 750 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

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to count occurrences of each item in an array.
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.
Suggested Courses

777 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