WordPress.org

Ready to get started?Download WordPress

Forums

3 digits months (7 posts)

  1. Co
    Member
    Posted 8 years ago #

    Hello :)

    I would like to display the months in three digits.

    I.e. MAY - APR - SEP instead of having the whole month name displayed (in order to display it into a small graphic calendar).

    Is there a way to do it ? Has it already been done ? Does a reference exist for it ?

    Thank you very much in advance :)

  2. maerk
    Member
    Posted 8 years ago #

    http://php.net/date

    Is that any good? M is the code to make three-letter month codes. So you'd do something like

    the_date('M');

    It's case-sensitive though.

    WordPress has a calendar built in, you know. The template tag is <?php get_calendar(); ?>.

  3. forceagainstsomething
    Member
    Posted 8 years ago #

    Go to the options menu, and then down to "Default date format", and change the value to 'M j, Y'. Minus the quotes of course.

  4. Co
    Member
    Posted 8 years ago #

    Thank you very much :) The 'M' works perfectly !
    Have a wonderful week-wend.

  5. maerk
    Member
    Posted 8 years ago #

    I'm glad it works for you :) If you wanted to make it all caps, you can use CSS, the rule is

    .whatever-selector-youre-using {
    text-transform: uppercase; }

  6. Co
    Member
    Posted 8 years ago #

    Hello, it's me again :)

    I've just tried out the M trick with the french version of WordPress, but it doesn't seem to work as my June month (juin) appears entirely (4 digits).

    Any idea of what I may be doing wrong ?

    Thanks !

  7. Co
    Member
    Posted 8 years ago #

    Well I did find the solution by myself. In fact WordPress is very intelligent ;) (more than myself, lol)

    The months june and july (respectively Juin et Juillet) do have the same first 3 digits. They need the 4th digit in order to establish a differenciation.

Topic Closed

This topic has been closed to new replies.

About this Topic