Joomla!
http://forum.joomla.org/

How do you Change the Date format?
http://forum.joomla.org/viewtopic.php?f=32&t=108077
Page 1 of 2

Author:  linkery [ Thu Oct 26, 2006 2:15 am ]
Post subject:  How do you Change the Date format?

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!

Author:  ledzep [ Thu Oct 26, 2006 2:45 am ]
Post subject:  Re: How do you Change the Date format?

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.

Author:  cronos916 [ Fri Nov 24, 2006 7:04 pm ]
Post subject:  Re: How do you Change the Date format?

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.

Author:  cronos916 [ Fri Nov 24, 2006 7:17 pm ]
Post subject:  Re: How do you Change the Date format?

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.

Author:  pe7er [ Fri Nov 24, 2006 7:59 pm ]
Post subject:  Re: How do you Change the Date format?

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

Author:  Silmeron [ Sun Mar 02, 2008 11:00 pm ]
Post subject:  Re: How do you Change the Date format?

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.

Author:  tomgreever [ Wed Apr 30, 2008 7:59 pm ]
Post subject:  Re: How do you Change the Date format?

This was very helpful for me. Thanks!

Author:  WDSJPK [ Sat May 03, 2008 4:02 pm ]
Post subject:  Re: How do you Change the Date format?

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 :(

Author:  capricious [ Mon Jun 02, 2008 7:55 am ]
Post subject:  Re: How do you Change the Date format?

Excellent information on the en-gb.ini fix - thank you very much.

Author:  simplewebworks [ Fri Jul 25, 2008 2:11 pm ]
Post subject:  Re: How do you Change the Date format?

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/option,com_mtree/task,viewlink/link_id,5341/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.

Author:  robind21283 [ Mon Oct 13, 2008 8:23 pm ]
Post subject:  Re: How do you Change the Date format?

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

Author:  Riavon [ Mon Jan 05, 2009 1:35 pm ]
Post subject:  Re: How do you Change the Date format?

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.

Author:  simplewebworks [ Mon Jan 05, 2009 3:49 pm ]
Post subject:  Re: How do you Change the Date format?

Thanks Riavon for the correction. Glad you got it working.

Author:  taxitango [ Wed Jan 14, 2009 10:41 pm ]
Post subject:  Re: How do you Change the Date format?

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) ?

Author:  mrscripto [ Sat Jan 17, 2009 11:25 pm ]
Post subject:  Re: How do you Change the Date format?

Any way to avoid having to change the date format each time you upgrade? ???

Author:  sambkk [ Wed Jan 28, 2009 7:56 pm ]
Post subject:  Re: How do you Change the Date format?

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

Author:  sungkhum [ Fri Feb 06, 2009 6:04 am ]
Post subject:  Re: How do you Change the Date format?

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!

Author:  ViperFish [ Fri Mar 06, 2009 4:01 am ]
Post subject:  Re: How do you Change the Date format?

Why is it that when I change my code to...

Code:
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?

Author:  dverger [ Mon Apr 13, 2009 1:53 am ]
Post subject:  Re: How do you Change the Date format?

Quote:
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:
      if(strpos($format, '%e') !== false)
             $format = str_replace('%e', date('j', $time), $format);

Author:  ViperFish [ Tue Apr 14, 2009 12:42 am ]
Post subject:  Re: How do you Change the Date format?

Yes. Once I uploaded the site to the Linux host it worked fine. It was a a Windows specific error.

Author:  mom2nine [ Mon Apr 20, 2009 4:04 am ]
Post subject:  Re: How do you Change the Date format?

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.

Author:  TheWebGuy [ Tue May 26, 2009 3:39 pm ]
Post subject:  Re: How do you Change the Date format in Admin?

Bump...

Quote:
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.

Author:  ViperFish [ Wed May 27, 2009 12:21 am ]
Post subject:  Re: How do you Change the Date format?

Open the file administrator/language/en_GB/en_GB.ini. On about line 14 change the %d and %m elements around.

Code:
DATE_FORMAT_LC4=%m.%d.%y

The file path may not be "en_GB". Depends on your selected language.

Author:  TheWebGuy [ Wed May 27, 2009 3:50 pm ]
Post subject:  Re: How do you Change the Date format?

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:
Quote:
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.

Author:  ViperFish [ Thu May 28, 2009 12:39 am ]
Post subject:  Re: How do you Change the Date format?

Not sure if this includes the admin but try the guide on this page - http://www.welcometojoomla.com/how-do-i/date-format.html

Author:  TheWebGuy [ Thu May 28, 2009 3:11 pm ]
Post subject:  Re: How do you Change the Date format?

Thanks for the link, however that doesn't change the date as I would like in the backend ADMIN.

Author:  barrycox [ Mon Jun 01, 2009 5:54 pm ]
Post subject:  Re: How do you Change the Date format?

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.

Author:  TheWebGuy [ Mon Jun 01, 2009 6:44 pm ]
Post subject:  Re: How do you Change the Date format?

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

Author:  Nevis1 [ Mon Jul 13, 2009 12:44 am ]
Post subject:  Re: How do you Change the Date format?

ViperFish wrote:
Open the file administrator/language/en_GB/en_GB.ini. On about line 14 change the %d and %m elements around.

Code:
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!

Author:  TheWebGuy [ Mon Jul 13, 2009 2:52 pm ]
Post subject:  Re: How do you Change the Date format?

Anyone have any suggestions on how to do this for Joomla 1.0.15?

TIA,
The Web Guy

Page 1 of 2 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/