How do you Change the Date format?

General questions relating to Joomla! There are other boards for more specific help on Joomla! features and extensions.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
linkery
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Thu Oct 26, 2006 2:06 am

How do you Change the Date format?

Post by linkery » Thu Oct 26, 2006 2:15 am

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!

ledzep

Re: How do you Change the Date format?

Post by ledzep » Thu Oct 26, 2006 2:45 am

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.

cronos916
Joomla! Intern
Joomla! Intern
Posts: 69
Joined: Wed Nov 15, 2006 7:33 pm

Re: How do you Change the Date format?

Post by cronos916 » Fri Nov 24, 2006 7:04 pm

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.

cronos916
Joomla! Intern
Joomla! Intern
Posts: 69
Joined: Wed Nov 15, 2006 7:33 pm

Re: How do you Change the Date format?

Post by cronos916 » Fri Nov 24, 2006 7:17 pm

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.

User avatar
pe7er
Joomla! Master
Joomla! Master
Posts: 24929
Joined: Thu Aug 18, 2005 8:55 pm
Location: Nijmegen, Netherlands
Contact:

Re: How do you Change the Date format?

Post by pe7er » Fri Nov 24, 2006 7:59 pm

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
Kind Regards,
Peter Martin, Global Moderator
Company website: https://db8.nl/en/ - Joomla specialist, Nijmegen, Netherlands
The best website: https://the-best-website.com

Silmeron
Joomla! Apprentice
Joomla! Apprentice
Posts: 25
Joined: Sun Mar 02, 2008 10:52 pm

Re: How do you Change the Date format?

Post by Silmeron » Sun Mar 02, 2008 11:00 pm

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.

User avatar
tomgreever
Joomla! Intern
Joomla! Intern
Posts: 79
Joined: Wed Nov 14, 2007 5:52 pm

Re: How do you Change the Date format?

Post by tomgreever » Wed Apr 30, 2008 7:59 pm

This was very helpful for me. Thanks!

WDSJPK
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed Jun 27, 2007 2:47 pm
Location: Glasgow

Re: How do you Change the Date format?

Post by WDSJPK » Sat May 03, 2008 4:02 pm

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

capricious
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Sun May 18, 2008 1:43 am

Re: How do you Change the Date format?

Post by capricious » Mon Jun 02, 2008 7:55 am

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

simplewebworks
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Thu May 22, 2008 4:06 am
Location: Lubbock, TX
Contact:

Re: How do you Change the Date format?

Post by simplewebworks » Fri Jul 25, 2008 2:11 pm

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.
Professional Website Development
http://www.simplewebworks.com

robind21283
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Thu Oct 02, 2008 2:15 am

Re: How do you Change the Date format?

Post by robind21283 » Mon Oct 13, 2008 8:23 pm

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

Riavon
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Mon Dec 29, 2008 2:11 pm

Re: How do you Change the Date format?

Post by Riavon » Mon Jan 05, 2009 1:35 pm

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.

simplewebworks
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Thu May 22, 2008 4:06 am
Location: Lubbock, TX
Contact:

Re: How do you Change the Date format?

Post by simplewebworks » Mon Jan 05, 2009 3:49 pm

Thanks Riavon for the correction. Glad you got it working.
Professional Website Development
http://www.simplewebworks.com

taxitango
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Sat Jan 10, 2009 8:20 pm

Re: How do you Change the Date format?

Post by taxitango » Wed Jan 14, 2009 10:41 pm

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

mrscripto
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Sun Dec 10, 2006 9:09 pm

Re: How do you Change the Date format?

Post by mrscripto » Sat Jan 17, 2009 11:25 pm

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

sambkk
Joomla! Intern
Joomla! Intern
Posts: 61
Joined: Wed Apr 11, 2007 1:01 pm
Contact:

Re: How do you Change the Date format?

Post by sambkk » Wed Jan 28, 2009 7:56 pm

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

sungkhum
Joomla! Intern
Joomla! Intern
Posts: 63
Joined: Wed May 24, 2006 1:51 pm

Re: How do you Change the Date format?

Post by sungkhum » Fri Feb 06, 2009 6:04 am

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!

User avatar
ViperFish
Joomla! Intern
Joomla! Intern
Posts: 67
Joined: Sun Oct 09, 2005 2:14 pm
Location: Western Australia
Contact:

Re: How do you Change the Date format?

Post by ViperFish » Fri Mar 06, 2009 4:01 am

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?

User avatar
dverger
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 146
Joined: Tue Aug 29, 2006 8:23 am
Location: Mallorca - Spain
Contact:

Re: How do you Change the Date format?

Post by dverger » Mon Apr 13, 2009 1:53 am

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);
Damià Verger - Member of the Catalan Joomla Translation Team
Be Free
http://www.joomla.cat - JUG Països Catalans & Catalan Joomla TT

User avatar
ViperFish
Joomla! Intern
Joomla! Intern
Posts: 67
Joined: Sun Oct 09, 2005 2:14 pm
Location: Western Australia
Contact:

Re: How do you Change the Date format?

Post by ViperFish » Tue Apr 14, 2009 12:42 am

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

User avatar
mom2nine
Joomla! Intern
Joomla! Intern
Posts: 53
Joined: Tue Aug 30, 2005 8:05 am
Location: Virginia
Contact:

Re: How do you Change the Date format?

Post by mom2nine » Mon Apr 20, 2009 4:04 am

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.

User avatar
TheWebGuy
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 135
Joined: Wed Oct 03, 2007 10:39 pm

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

Post by TheWebGuy » Tue May 26, 2009 3:39 pm

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.
I know it's better to teach a man to fish...but if that man is starving, he'll die before he catches a fish. So do him a favor, feed him first...then teach him to fish.

User avatar
ViperFish
Joomla! Intern
Joomla! Intern
Posts: 67
Joined: Sun Oct 09, 2005 2:14 pm
Location: Western Australia
Contact:

Re: How do you Change the Date format?

Post by ViperFish » Wed May 27, 2009 12:21 am

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.

User avatar
TheWebGuy
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 135
Joined: Wed Oct 03, 2007 10:39 pm

Re: How do you Change the Date format?

Post by TheWebGuy » Wed May 27, 2009 3:50 pm

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.
I know it's better to teach a man to fish...but if that man is starving, he'll die before he catches a fish. So do him a favor, feed him first...then teach him to fish.

User avatar
ViperFish
Joomla! Intern
Joomla! Intern
Posts: 67
Joined: Sun Oct 09, 2005 2:14 pm
Location: Western Australia
Contact:

Re: How do you Change the Date format?

Post by ViperFish » Thu May 28, 2009 12:39 am

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

User avatar
TheWebGuy
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 135
Joined: Wed Oct 03, 2007 10:39 pm

Re: How do you Change the Date format?

Post by TheWebGuy » Thu May 28, 2009 3:11 pm

Thanks for the link, however that doesn't change the date as I would like in the backend ADMIN.
I know it's better to teach a man to fish...but if that man is starving, he'll die before he catches a fish. So do him a favor, feed him first...then teach him to fish.

barrycox
Joomla! Apprentice
Joomla! Apprentice
Posts: 19
Joined: Sat May 13, 2006 1:17 am

Re: How do you Change the Date format?

Post by barrycox » Mon Jun 01, 2009 5:54 pm

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.

User avatar
TheWebGuy
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 135
Joined: Wed Oct 03, 2007 10:39 pm

Re: How do you Change the Date format?

Post by TheWebGuy » Mon Jun 01, 2009 6:44 pm

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
I know it's better to teach a man to fish...but if that man is starving, he'll die before he catches a fish. So do him a favor, feed him first...then teach him to fish.

Nevis1
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Sun Apr 12, 2009 9:51 am

Re: How do you Change the Date format?

Post by Nevis1 » Mon Jul 13, 2009 12:44 am

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!

User avatar
TheWebGuy
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 135
Joined: Wed Oct 03, 2007 10:39 pm

Re: How do you Change the Date format?

Post by TheWebGuy » Mon Jul 13, 2009 2:52 pm

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

TIA,
The Web Guy
I know it's better to teach a man to fish...but if that man is starving, he'll die before he catches a fish. So do him a favor, feed him first...then teach him to fish.


Locked

Return to “General Questions - 1.0.x”