Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • cwilborngv Friend
    #175685

    I’d like to change the date format in two sections of the website, and I’m not able to find out how:

    http://beta.gazettevirginian.com/

    At the very top right, I’d like to have the full month spelled out and the date without “0” before a single digit.

    On article pages I’d like for the created/modified date to appear as time, AM/PM, xx/xx/xx (example: 07:51 AM 04/02/12)

    Thanks!

    TomC Moderator
    #446895

    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-1
    2. dateformat-done
    3. dateformat-0
    cwilborngv Friend
    #446900

    After doing this I have garble in the dateline: LAST UPDATED ON %AM, %565 %02, %2012

    Example: http://beta.gazettevirginian.com/index.php/news/local-news/615-band-gets-crowd-pumped-in-south-boston-concert

    TomC Moderator
    #446903

    <em>@cwilborngv 311759 wrote:</em><blockquote>After doing this I have garble in the dateline: LAST UPDATED ON %AM, %565 %02, %2012

    Example: http://beta.gazettevirginian.com/index.php/news/local-news/615-band-gets-crowd-pumped-in-south-boston-concert</blockquote>
    My apologies . . . . that’s Linux date format code, and you’ll need to change it to this: DATE_FORMAT_LC2= %B %d, %Y

    I’ve updated my original info above as well.

    cwilborngv Friend
    #446905

    Thanks … but it still looks garbled: LAST UPDATED ON %565 %02, %2012

    Is there a different code I should be using on this template or somewhere else to look? I’d like the time/date to appear like this: 09:02 AM 04/02/12

    Thanks!

    TomC Moderator
    #446908
    Hmmm …. I’m reviewing this as well . . .

    Try only writing B d, Y :3

    Apparently B and b no longer work for month, but F (full name) and M (3 letter abbreviation) do.

    cwilborngv Friend
    #446912

    Yeah, I was wondering about the codes … because I couldn’t get any of them to work properly! 🙁

    Here’s the latest update …. LAST UPDATED ON 565 02, 2012 :3

    TomC Moderator
    #447034

    <em>@cwilborngv 311777 wrote:</em><blockquote>Yeah, I was wondering about the codes … because I couldn’t get any of them to work properly! 🙁

    Here’s the latest update …. LAST UPDATED ON 565 02, 2012 :3</blockquote>
    Try this format –> DATE_FORMAT_LC2=”h:i A d/m/y

    cwilborngv Friend
    #447110

    PERFECT!!! Thanks a bunch!!

    Now, is there a way to change the date at the very top of the site (upper left) so the month is spelled out and there’s no “0” in front of single-digit days? 🙂

    TomC Moderator
    #447134

    <em>@cwilborngv 312019 wrote:</em><blockquote>PERFECT!!! Thanks a bunch!!

    Now, is there a way to change the date at the very top of the site (upper left) so the month is spelled out and there’s no “0” in front of single-digit days? :)</blockquote>

    To see a list of all of the date format options in php, go to this link –> http://us2.php.net/strftime/
Viewing 10 posts - 1 through 10 (of 10 total)

This topic contains 10 replies, has 2 voices, 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