[Home]WikiPatches/TwentyFourHourFormat

UseModWiki | WikiPatches | RecentChanges | Preferences

Implement the suggestion below:
24 hour time format
Please provide Preferences option to display time in 24-hour format
12-hour and am/pm is awfully anglo-centric. -- era

Personally I prefer 12-hour format, but anyway whether applying the patch is a choice of the webmaster.

--- wiki_92.pl	2002-12-14 20:58:56.000000000 -0600
+++ wiki_24hr.cgi	2002-12-20 15:37:20.000000000 -0600
@@ -38,7 +38,7 @@
   $UseSubpage $UseCache $RawHtml $SimpleLinks $NonEnglish $LogoLeft
   $KeepDays $HtmlTags $HtmlLinks $UseDiffLog $KeepMajor $KeepAuthor
   $FreeUpper $EmailNotify $SendMail $EmailFrom $FastGlob $EmbedWiki
-  $ScriptTZ $BracketText $UseAmPm $UseConfig $UseIndex $UseLookup
+  $ScriptTZ $BracketText $UseConfig $UseIndex $UseLookup
   $RedirType $AdminPass $EditPass $UseHeadings $NetworkFile $BracketWiki
   $FreeLinks $WikiLinks $AdminDelete $FreeLinkPattern $RCName $RunCGI
   $ShowEdits $ThinLine $LinkPattern $InterLinkPattern $InterSitePattern
@@ -111,7 +111,6 @@
 $NonEnglish  = 0;       # 1 = extra link chars,   0 = only A-Za-z chars
 $ThinLine    = 0;       # 1 = fancy <hr> tags,    0 = classic wiki <hr>
 $BracketText = 1;       # 1 = allow [URL text],   0 = no link descriptions
-$UseAmPm     = 1;       # 1 = use am/pm in times, 0 = use 24-hour times
 $UseIndex    = 0;       # 1 = use index file,     0 = slow/reliable method
 $UseHeadings = 1;       # 1 = allow = h1 text =,  0 = no header formatting
 $NetworkFile = 1;       # 1 = allow remote file:, 0 = no file:// links
@@ -2356,7 +2355,7 @@
     $mytz = " " . $ScriptTZ;
   }
   $ampm = "";
-  if ($UseAmPm) {
+  if (!&GetParam('24hour', 0)) {
     $ampm = " am";
     if ($hour > 11) {
       $ampm = " pm";
@@ -2721,7 +2720,8 @@
   # Note: TZ offset is added by TimeToText, so pre-subtract to cancel.
   print '<br>', T('Server time:'), ' ', &TimeToText($Now-$TimeZoneOffset);
   print '<br>', T('Time Zone offset (hours):'), ' ',
-        &GetFormText('tzoffset', 0, 4, 9);
+        &GetFormText('tzoffset', 0, 4, 9),
+	' ', &GetFormCheck('24hour', 0, T('24 hour time display'));
   print '<br>', &GetFormCheck('editwide', 1,
                               T('Use 100% wide edit area (if supported)'));
   print '<br>',
@@ -2835,7 +2835,8 @@
     &UpdatePrefNumber("defaultdiff", 1, 1, 3);
   }
   &UpdatePrefNumber("rcshowedit", 1, 0, 2);
-  &UpdatePrefNumber("tzoffset", 0, -999, 999);
+  &UpdatePrefNumber("tzoffset", 0, -999, 999);
+  &UpdatePrefCheckbox('24hour');
   &UpdatePrefNumber("editrows", 1, 1, 999);
   &UpdatePrefNumber("editcols", 1, 1, 999);
   print T('Server time:'), ' ', &TimeToText($Now-$TimeZoneOffset), '<br>';

I wonder why no one submitted this tiny patch. Or I just don't know someone did?

--TakuyaMurata


UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited May 22, 2009 4:30 pm by GunnarH (diff)
Search: