Change [[ETM:timecreated]] display format

Change [[ETM:timecreated]] display format

by Iruma Tenji -
Number of replies: 5
Hi,

I want to ETM:timecreated  display format,
From Wednesday, 11 May 2016, 4:07 PM
To Wed, 11 May 16, 4:07 PM

I don't want to use java script to change it, i want directly modify in the code.
which php file i can modify it?

Average of ratings: -
In reply to Iruma Tenji

Re: Change [[ETM:timecreated]] display format

by Itamar Tzadok -

ETM:timecreated:date uses the format defined in the strftimedate lang string. By default it is %d %B %Y. You can customize it as desired. It would affect other time displays in Moodle that uses it but last time I checked there weren't too many of those.

Alternately, you can use the other field patterns to compose the time display. See Dataformfield_entrytime#Patterns for the list of available patterns.

hth smile

In reply to Itamar Tzadok

Re: Change [[ETM:timecreated]] display format

by Iruma Tenji -

Hi Itamar

As you mentioned ETM:timecreated:date uses the format defined in the strftimedate lang string. By default it is %d %B %Y. So if i want to customize it, which php file should change?

i prefer using this method instead of using Dataformfield_entrytime#Patterns. This is because, if i use ETM:timecreated:hour, it just change the hour format, but what i want is i am able to display whole date, and change some part format of it.

For example:

From Wednesday, 11 May 2016, 4:07 PM
To Wed, 11 May 16, 4:07 PM

In reply to Iruma Tenji

Re: Change [[ETM:timecreated]] display format

by Hartmut Scherer -

Hi Iruma,

I guess I found the php file. If you want to change the strftimedate lang string in English, you will find the file langconfig.php in moodle/lang/en.

Documentation for date/time function is here. This change will affect your entire site, not only the Dataform module.

With kind regards,

Hartmut

In reply to Hartmut Scherer

Re: Change [[ETM:timecreated]] display format

by Itamar Tzadok -

With this approach you don't need to change the source code. You can customize lang strings via the standard Moodle UI at Site administration -> Language -> Language customization. smile