Time and Date Formatting in JEvents

FAQ

In JEvents you can override the formatting of dates and times by changing the translations of various key translation strings (see the related link at the bottom of this page for an explanation about how to customise parts of the JEvents translations).  If you want to do this then on the first tab of the JEvents config you should make sure you set the option to use date formats from the language file.

In english the default translation strings are:

DATE_FORMAT_0="%A, %d %B %Y" which results in: Monday, 20 May 2013

DATE_FORMAT_1="%d %B %Y" which results in: 20 May 2013

DATE_FORMAT_2="%d %B" which results in: 20 May

DATE_FORMAT_3="%B %Y" which results in: May 2013

DATE_FORMAT_4="%d/%m/%Y" which results in: 20/05/2013

DATE_FORMAT_5="%d/%m" which results in: 20/05

DATE_FORMAT_6="%m/%Y" which results in: 05/2013

DATE_FORMAT_7="%A, %d" which results in: Monday, 20

JEV_TIME_FORMAT="%l:%M" which results in: 10:52

These use the strftime formatting mechanism (see http://php.net/manual/en/function.strftime.php) and to test your strings without making live changes you can use this useful site: http://strftime.onlinephpfunctions.com/

So if you want to change a specific date format - find the translation string that matches the current format and change it in your translation override file.

e.g. "Sunday, 07 January 2012" is from format DATE_FORMAT_0 so if you want this to read : "Sun: 7 Jan 2012" override the translation with "%a: %e %b %Y".

Customizing date format for Custom Layouts

If you want to customize the date format when using a Custom Layout, you can use strftime syntax preceded by a semicolon in the tags of your layout to format the date. You should use this with the following syntax:

[codep]{{Start Date:STARTDATE;STRFTIME_SYNTAX}}[/codep]

So for instance to show your start date as Monday, 20 May 2013, you should write down:

[codep]{{Start Date:STARTDATE;%A, %d %B %Y}}[/codep]

related cats 1,3