Page 1 of 2

How do you Change the Date format?

Posted: Thu Oct 26, 2006 2:15 am
by linkery
I realize that this is an international product, the first of which I have ever used and I have been incredibly pleased, except I have come across one problem so far.

How do I change the current date format from day/month/year to month/day/year (the American format)

Its affecting all of my modules as well (I think).  I have the locale set correctly (Eastern Time US, country locale is en_US)
I have tried and tried to change it in the language file, but it keeps resetting to the wrong format.

Its affecting the event calendar "upcoming events" calendar on the main page.  Could it be a problem with that module?

Its confusing my users quite a bit and the sooner I can get it fixed the better

Thank you!

Re: How do you Change the Date format?

Posted: Thu Oct 26, 2006 2:45 am
by ledzep
You will need to look in the language file under /languages/english[or whatever language your using].php

Look for:

/** templates/*.php */

DEFINE('_ISO','charset=iso-8859-1');

DEFINE('_DATE_FORMAT','l, F d Y');  //Uses PHP's DATE Command Format - Depreciated

/**

* Modify this line to reflect how you want the date to appear in your site

*

*e.g. DEFINE("_DATE_FORMAT_LC","%A, %d %B %Y %H:%M"); //Uses PHP's strftime Command Format

*/

DEFINE('_DATE_FORMAT_LC',"%A, %d %B %Y"); //Uses PHP's strftime Command Format

DEFINE('_DATE_FORMAT_LC2',"%A, %d %B %Y %H:%M");

and make the necessary alterations to have the date/time formatted as you wish.

Re: How do you Change the Date format?

Posted: Fri Nov 24, 2006 7:04 pm
by cronos916
Could you provide further detailed instructions for those PHP coding brain dead.

I have found that section in the file you specified, how does the code need to be modified. Sorry I understand html and css, but not php. YET.

Re: How do you Change the Date format?

Posted: Fri Nov 24, 2006 7:17 pm
by cronos916
ok, i think i was able to solve it so far. Did a quick google search. I understand how to change the date. What is the LC and LC2 stand for? I also noticed the date is only displayed correctly on the actual pages. It doesn't display correctly inside the admin areas.

Re: How do you Change the Date format?

Posted: Fri Nov 24, 2006 7:59 pm
by pe7er
cronos916 wrote:I have found that section in the file you specified, how does the code need to be modified. Sorry I understand html and css, but not php. YET.
For the possible notations see PHP's strftime Command Format: http://php.net/manual/en/function.strftime.php

Re: How do you Change the Date format?

Posted: Sun Mar 02, 2008 11:00 pm
by Silmeron
How to do this using Joomla 1.5, assuming you want to change the default English:

1. Navigate to the language\en-GB folder in your Joomla install.
2. Edit the en-GB.ini file.
3. Change the date formats near the top. The parameters you see there (that is %A, %H, etc.) are replacements for the formatting of the date. The available parameters can be found in the PHP link in the above post.

An example for my particular setup, I wanted to switch to a format that looks like this for my front page articles.

Sunday, March 3 2008

I changed DATE_FORMAT_LC2 key to the parameters below to accomplish this:

DATE_FORMAT_LC2=%A, %B %d %Y

Reload the front page, and it was good to go.

Hope this helps.

Re: How do you Change the Date format?

Posted: Wed Apr 30, 2008 7:59 pm
by tomgreever
This was very helpful for me. Thanks!

Re: How do you Change the Date format?

Posted: Sat May 03, 2008 4:02 pm
by WDSJPK
I am not having any success with formatting date to the British way that is dd-mm-yyyy.
The code that I have modified is located at
includes/js/calendar/lang/calaendar-en.js

The section of the code that I have tried is as follows:
// date formats
Calendar._TT["DEF_DATE_FORMAT"] = "dd-mm-Y";
Calendar._TT["TT_DATE_FORMAT"] = "D, M d";

I have only edited the first line of the code. But no matter what I change it to, it still displays American date format ie yyyy-mm-dd.
Any help will be much appreciated. Sorry I am not a programmer.
wdsjpk :(

Re: How do you Change the Date format?

Posted: Mon Jun 02, 2008 7:55 am
by capricious
Excellent information on the en-gb.ini fix - thank you very much.

Re: How do you Change the Date format?

Posted: Fri Jul 25, 2008 2:11 pm
by simplewebworks
If you are trying to accomplish a standard US English format (Month Day Year) and you do not wish to manually change your language file and you are using Joomla! 1.5.3+ you might consider using Dave Morgan's American English translation language file found here: http://extensions.joomla.org/component/ ... Itemid,35/.

By installing that, you will see the American English version of the date (Month Day Year) displayed and this will prevent you from having to change your language files. Hope that helps. Thanks to Dave Morgan for the translation.

Re: How do you Change the Date format?

Posted: Mon Oct 13, 2008 8:23 pm
by robind21283
If you're using GCalendar,
Go to the module, then in the parameters put whatever you want from the table on GCalendar's website:

http://gcalendar.allon.ch/content/exten ... odule.html

Re: How do you Change the Date format?

Posted: Mon Jan 05, 2009 1:35 pm
by Riavon
To "simplewebworks" - I installed that extension but nothing changed on my site, it still has the 'backwards' European date and time format, not the American date/time format. Guess we will have to just bite the bullet do it the hard way by re-coding the PHP file. Yikes.

[EDIT]: I stand corrected. What is not explained in the post is that once the simplewebworks extension is installed, you must take the additional step of logging into your language manager on your Joomla admin, then select the "English US" as the default. Then, it works beautifully. A simple "Once installed, set default to "English US" in language manager" would have been great.

Just wanted other American folks to know that the extension is, after all, a nifty solution to this date/time format problem.

Re: How do you Change the Date format?

Posted: Mon Jan 05, 2009 3:49 pm
by simplewebworks
Thanks Riavon for the correction. Glad you got it working.

Re: How do you Change the Date format?

Posted: Wed Jan 14, 2009 10:41 pm
by taxitango
The extension works fine. But how do you get Joomla to knock it off with the two-digit day? (Jan 08, 2009 vs. Jan 8, 2009) ?

Re: How do you Change the Date format?

Posted: Sat Jan 17, 2009 11:25 pm
by mrscripto
Any way to avoid having to change the date format each time you upgrade? ???

Re: How do you Change the Date format?

Posted: Wed Jan 28, 2009 7:56 pm
by sambkk
hi Guys
I may be missing something obvious but I am (desperately) trying to get the date from Sunday,10 January to Sunday, 10 Jan or Sun 10 Jan, that is to get my beloved joomla to start using abbreviated days and months. I installed the us language pack ´just fine and thats great but I cant figure out the php file since apparently thats where I need to go to get the short format I assume.

In short I am looking for Monday, January 05 2009
to display as Mon, Jan 5 2009

Thanks in advance for any help

Sami

-- ok figured it out, just need to find the right spot LC1 vs LC 2 etc

Re: How do you Change the Date format?

Posted: Fri Feb 06, 2009 6:04 am
by sungkhum
Great - thanks. I wanted to remove the time stamp and just keep the date.

I changed mine in 1.5
DATE_FORMAT_LC2=%B %d, %Y

and it returns: November 10, 2008

Perfect!

Re: How do you Change the Date format?

Posted: Fri Mar 06, 2009 4:01 am
by ViperFish
Why is it that when I change my code to...

Code: Select all

DATE_FORMAT_LC2=%e %B %Y
...I can't get a date at all. Changing the %d to %e should remove the 0 padding before the day number ie 05 May becomes "5 may". According to PHP strftime functions, it's a valid format code. Does Joomla have it's own date formatting code hidden away somewhere?

Re: How do you Change the Date format?

Posted: Mon Apr 13, 2009 1:53 am
by dverger
Changing the %d to %e should remove the 0 padding before the day number ie 05 May becomes "5 may". According to PHP strftime functions, it's a valid format code.
It's true on non-Windows platforms ;)
According to php.net Manual, %e will not work on Windows, some Linux distributions, and a few other operating systems.
Try adding this code to libraries\joomla\utilities\date.php, in _strftime function, just before $date = strftime($format, $time);

Code: Select all

		if(strpos($format, '%e') !== false)
			    $format = str_replace('%e', date('j', $time), $format);

Re: How do you Change the Date format?

Posted: Tue Apr 14, 2009 12:42 am
by ViperFish
Yes. Once I uploaded the site to the Linux host it worked fine. It was a a Windows specific error.

Re: How do you Change the Date format?

Posted: Mon Apr 20, 2009 4:04 am
by mom2nine
Is there a similar fix for the admin side? Currently the dates for articles in the article manager are displayed dd.mm.yy instead of mm.dd.yy. I know it's a silly little thing, but for me as an American it's always confusing to look at the list and figure out what day an item was posted.

Re: How do you Change the Date format in Admin?

Posted: Tue May 26, 2009 3:39 pm
by TheWebGuy
Bump...
Is there a similar fix for the admin side?
Would like the dates in Admin > Content to display as American type and changing the language file doesn't do it. Right now it displays as Day-Month-Year (see below)

Image

I would just like to make the Dates "readable" for Content items as in Month-Day-Year.
Any Help is appreciated please.
Using Joomla 1.1.5

Thanks.

Re: How do you Change the Date format?

Posted: Wed May 27, 2009 12:21 am
by ViperFish
Open the file administrator/language/en_GB/en_GB.ini. On about line 14 change the %d and %m elements around.

Code: Select all

DATE_FORMAT_LC4=%m.%d.%y
The file path may not be "en_GB". Depends on your selected language.

Re: How do you Change the Date format?

Posted: Wed May 27, 2009 3:50 pm
by TheWebGuy
Thanks for your response however I believe that it is for Joomla 1.5...

I am using Joomla 1.0.15 (sorry I missed posted the version above)

Do you know how to do this for v1.0.15?...in ADMIN
I changed the entries in the language/english.php to:
DEFINE('_DATE_FORMAT_LC',"%m/%d/%Y"); //Uses PHP's strftime Command Format
DEFINE('_DATE_FORMAT_LC2',"%A, %B %d, %Y");
But that had no effect on the content items date in ADMIN.

Thanks for the help with this.

Re: How do you Change the Date format?

Posted: Thu May 28, 2009 12:39 am
by ViperFish
Not sure if this includes the admin but try the guide on this page - http://www.welcometojoomla.com/how-do-i ... ormat.html

Re: How do you Change the Date format?

Posted: Thu May 28, 2009 3:11 pm
by TheWebGuy
Thanks for the link, however that doesn't change the date as I would like in the backend ADMIN.

Re: How do you Change the Date format?

Posted: Mon Jun 01, 2009 5:54 pm
by barrycox
it worked for me on the backend in joomla 1.5.10 by changing en en-GB.ini file in administrator/languages/en-GB to:

DATE_FORMAT_LC=%A, %B %e %Y
DATE_FORMAT_LC1=%A, %B %e %Y
DATE_FORMAT_LC2=%A, %B %e %Y %H:%M
DATE_FORMAT_LC3=%B %e %Y
DATE_FORMAT_LC4=%m/%d/%y
DATE_FORMAT_JS1=m-d-y
# %Y-%M-%D=%Y-%M-%D
%M-%D-%Y=%M-%D-%Y
%A, %B %E=%A, %B %e

note that the LC4 entry is the only one that mattered on the content dates.

Re: How do you Change the Date format?

Posted: Mon Jun 01, 2009 6:44 pm
by TheWebGuy
Thanks for the reply.

Yes, I understand that your solution does work for Joomla 1.5 as I do run both versions 1.0.15 and 1.5.

However, it doesn't work for Joomla 1.0.15

Anyone have any suggestions for Joomla 1.0.15?

Thanks again,
Kevin

Re: How do you Change the Date format?

Posted: Mon Jul 13, 2009 12:44 am
by Nevis1
ViperFish wrote:Open the file administrator/language/en_GB/en_GB.ini. On about line 14 change the %d and %m elements around.

Code: Select all

DATE_FORMAT_LC4=%m.%d.%y
The file path may not be "en_GB". Depends on your selected language.

Thanks for this, worked like a charm!

Re: How do you Change the Date format?

Posted: Mon Jul 13, 2009 2:52 pm
by TheWebGuy
Anyone have any suggestions on how to do this for Joomla 1.0.15?

TIA,
The Web Guy