Format timestamp
- Moodle 3.3–3.4
- 更新 2017-11-22
This filter allows you to run a timestamp through the userdate function before it gets displayed. Initially built to allow proper dates to be displayed by block_configurablereport.
README
This filter allows you to run a timestamp through the userdate function before it gets displayed.
How do I get set up?
Place the files into filter/formattimestamp and run notifications.
In order to use the filter use span tags within your content as below:
< span class = ” formattimestamp ” >1510656103</ span >
Where “1510656103” is a valid Unix timestamp.
If you wish to show the date for a different timezone you can supply one as below:
< span class = ” formattimestamp ” >1510656103 Pacific/Fiji</ span >
Where Pacific/Fiji is any valid time zone for your version of PHP as listed on http://php.net/manual/en/timezones.php
If you wish to show the date in a different format you can supply one as below:
< span class = ” formattimestamp_format_strftimemonthyear ” >1510656103</ span >
Where strftimemonthyear is any date format from lang/en/langconfig.php e.g.
$string[‘strftimedate’] = ‘%d %B %Y’;
$string[‘strftimedatefullshort’] = ‘%d/%m/%y’;
$string[‘strftimedateshort’] = ‘%d %B’;
$string[‘strftimedatetime’] = ‘%d %B %Y, %I:%M %p’;
$string[‘strftimedatetimeshort’] = ‘%d/%m/%y, %H:%M’;
$string[‘strftimedaydate’] = ‘%A, %d %B %Y’;