Alternative English date formats

Making a language file to display English dates in an alternative format.

SPIP date tags such as [(#DATE|affdate)] display dates in English in this format: 23 September 2006

This is—inasmuch as any standard exists—correct British

“Dates should be shown in the order day, month, year, without internal punctuation, as: 2 November 1993. A named day preceding a date is separated by a comma: Tuesday, 2 November 1993. There is no comma between month and year. (...) In US style the order is month, day, year: November 2, 1993 (...)
Do not use the endings ‘st’, ‘rd’ or ‘th’ in conjunction with a figure.”
(Oxford Guide to Style pp. 178-9, Oxford University Press, 2002)

But it is not difficult to change!

SPIP 1.8 allows for local language files (in this case, a file named local_en.php3) to override the default language texts.

American format

Here are the necessary lines for such a file to give dates in American format (i.e. September 23; September 23, 2006):

// This is a SPIP language file
$GLOBALS[$GLOBALS['idx_lang']] = array(

'date_de_mois_1' => '@nommois@ @j@',
'date_de_mois_10' => '@nommois@ @j@',
'date_de_mois_11' => '@nommois@ @j@',
'date_de_mois_12' => '@nommois@ @j@',
'date_de_mois_2' => '@nommois@ @j@',
'date_de_mois_3' => '@nommois@ @j@',
'date_de_mois_4' => '@nommois@ @j@',
'date_de_mois_5' => '@nommois@ @j@',
'date_de_mois_6' => '@nommois@ @j@',
'date_de_mois_7' => '@nommois@ @j@',
'date_de_mois_8' => '@nommois@ @j@',
'date_de_mois_9' => '@nommois@ @j@',
'date_fmt_jour_mois_annee' => '@jourmois@, @annee@'


Alternative British format

Even if the Oxford Guide to Style suggests you shouldn’t, some people like ‘st’, ‘th’, etc. in their dates. Well, you can get them by using these lines:

// This is a SPIP language file
$GLOBALS[$GLOBALS['idx_lang']] = array(

'date_jnum1' => '1st',
'date_jnum2' => '2nd',
'date_jnum3' => '3rd',
'date_jnum4' => '4th',
'date_jnum5' => '5th',
'date_jnum6' => '6th',
'date_jnum7' => '7th',
'date_jnum8' => '8th',
'date_jnum9' => '9th',
'date_jnum10' => '10th',
'date_jnum11' => '11th',
'date_jnum12' => '12th',
'date_jnum13' => '13th',
'date_jnum14' => '14th',
'date_jnum15' => '15th',
'date_jnum16' => '16th',
'date_jnum17' => '17th',
'date_jnum18' => '18th',
'date_jnum19' => '19th',
'date_jnum20' => '20th',
'date_jnum21' => '21st',
'date_jnum22' => '22nd',
'date_jnum23' => '23rd',
'date_jnum24' => '24th',
'date_jnum25' => '25th',
'date_jnum26' => '26th',
'date_jnum27' => '27th',
'date_jnum28' => '28th',
'date_jnum29' => '29th',
'date_jnum30' => '30th',
'date_jnum31' => '31st'



If you want Spip tags to display with one of these alternative formats then:

  1. Create a file called local_en.php3. [1]
  2. Copy the lines of the format you choose (all the lines, from <?php to ?> included) into the file.
  3. Place the file in your templates directory, or in the root of the site, or in the ecrire/lang/ directory of your site.


[1If you are already using a local_en.php3 file, then integrate the lines above without repeating the first 3 or the last 2 lines of code.

updated on 25 January 2007


Une discussion

  • 1

    Aider moi s’il vous plait.

    J’ai conçu mon site en Anglais, mais les dates s’affiche tours en Français. Comment puis-je faire pour que les dates s’affiche en Anglais?

    Je vous remerci

    • Il faut aller dans l’espace privé. Configuration>langue principale du site et sélectionner l’anglais.

    Reply to this message

Ajouter un commentaire

Who are you?
[Log in]

To show your avatar with your message, register it first on (free et painless) and don’t forget to indicate your Email addresse here.

Enter your comment here

This form accepts SPIP shortcuts {{bold}} {italic} -*list [text->url] <quote> <code> and HTML code <q> <del> <ins>. To create paragraphs, just leave empty lines.

Add a document

Follow the comments: RSS 2.0 | Atom