Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
CFG->nofixday can override the ficing of day format in userdate
  • Loading branch information
moodler committed Mar 10, 2005
1 parent 27bf9e2 commit 1ac7ee2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions config-dist.php
Expand Up @@ -199,6 +199,10 @@
// settings. Use this if you want to control session configuration
// from php.ini, httpd.conf or .htaccess files.
// $CFG->respectsessionsettings = true;
//
// This setting will cause the userdate() function not to fix %d in
// date strings, and just let them show with a zero prefix.
// $CFG->nofixday = true;

//=========================================================================
// ALL DONE! To continue installation, visit your main page with a browser
Expand Down
10 changes: 8 additions & 2 deletions lib/moodlelib.php
Expand Up @@ -691,13 +691,19 @@ function format_time($totalsecs, $str=NULL) {
*/
function userdate($date, $format='', $timezone=99, $fixday = true) {

global $CFG;

static $strftimedaydatetime;

if ($format == '') {
$format = get_string('strftimedaydatetime');
if (empty($strftimedaydatetime)) {
$strftimedaydatetime = get_string('strftimedaydatetime');
}
$format = $strftimedaydatetime;
}

$formatnoday = str_replace('%d', 'DD', $format);
if ($fixday) {
if ($fixday and empty($CFG->nofixday)) { // Config.php can force %d not to be fixed.
$fixday = ($formatnoday != $format);
}

Expand Down

0 comments on commit 1ac7ee2

Please sign in to comment.