SPIP - Contrib

SPIP - Contrib

[ar] [en] [es] [fr] [it]

77 visitors now

fontsizeup fontsizedown
Home page > English > Date and Time processing > Alternative English date formats

Alternative English date formats

Monday 25 April 2005, by paolo

All the versions of this article: [English] [français]

0 vote

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

“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):

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:

Instructions

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.

Footnotes

[1] If 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.

Reply to this article

Back to top

Here they're talking