Viewing 1 post (of 1 total)
  • Author
    Posts
  • TomC Moderator
    #175691

    How To Change Date Format in Joomla

    When Joomla is installed, it shows dates in a European format, and it includes the minute and time that an article is created. For example, look at the date in the screen shot below:

    Depending on where in the world you are, you may want the dates to be in a different format. Joomla can format them any way you want, but the date format is a bit hard to find in the “language file.” And, you cannot easily get to it from within Joomla itself, so that makes it a bit more difficult.

    HERE IS HOW TO CHANGE IT . . . .

    We will be changing the date to an American format, and let’s drop the reference to the minute and second when the article is created. Our goal is for the article date to look like this: December 25, 2011


    Since we cannot get to the “language” files from within a default Joomla installation, let’s use an FTP program to access the files. Start your FTP program and log into your website. If you don’t have an FTP program, I recommend FileZilla as a very good FREE FTP client program.

    NOTE:
    <blockquote>If you are working on your Joomla website on your own computer using a “localhost” approach, this is much easier. You don’t need to use an FTP program. Just navigate to the proper folder in your computer’s file system.
    </blockquote>

    STEP ONE:
    Navigate to the following folder –> /language/en-GB

    Now, look for the file titled en-GB.ini. It is a plain text file, so you can edit that with a text editor.

    This will load the language file in your editor. Joomla uses this file to keep the words and phrases that it uses, but it also keeps the date codes in there, too.

    Scroll down until you see these lines:

    STEP TWO:
    FOR J1.5 – J1.7 . . . .
    You want to change this line a bit. The %H:%M at the end refers to “show the hour and the minute.” We don’t really need that on our site, so delete those codes.

    So, now we have this:
    DATE_FORMAT_LC2=%A, %d %B %Y

    That’s Linux date format code, and you’ll need to change it to this:
    DATE_FORMAT_LC2= %B %d, %Y

    FOR J2.5.x . . . .
    DATE_FORMAT_LC2=”h:i A d/m/y

    STEP THREE:
    FOR J1.5 – J1.7.x . . .
    Next we will change the date format to the American format of “December 25, 2011”

    So, let’s switch the %d (which displays the date number) and the %B (which shows the month as a word. And, let’s add a comma (,) between the day and the year.

    So, we now have
    DATE_FORMAT_LC2= %B %d, %Y

    FOR J2.5, same format as in STEP TWO above . . . .
    DATE_FORMAT_LC2=”h:i A d/m/y

    FINISH:
    Save your changes (and be sure that they upload back to your webserver).
    Check your site now (be sure to refresh the page to reload the latest changed.

    To see a list of all of the date format options in php, go to this link:http://us2.php.net/strftime/

    AN IMPORTANT NOTE TO KEEP IN MIND:
    <blockquote>When you make this change, you’re editing a core Joomla file. When you upgrade Joomla, there’s a chance that there will be a new language directory, a new en-GB directory, or a new en-GB.ini file.

    If that’s the case, when you upgrade, your date change will be lost, since the en-GB.ini file that you edited will be overwritten by the new one in the Joomla upgrade package.

    If you’re fine with potentially needing to make this simple change each time you upgrade, then you’re fine.</blockquote>


    1. dateformat-done
    2. dateformat-1
    3. dateformat-0
Viewing 1 post (of 1 total)

This topic contains 1 reply, has 1 voice, and was last updated by  TomC 12 years, 7 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum