← Back to team overview

mahara-contributors team mailing list archive

[Bug 1451328] Re: Timezone identifier support for PHP on Windows

 

I see now that at the top of the php.net strftime page, it points you to
this URL to see the date formatting parameters that are supported in
Windows:

https://msdn.microsoft.com/en-us/library/fe06s4ak.aspx

Hm, so it appears that the following PHP strftime() parameters are not
supported in Windows: CDFGPRTVeghklnrtu. And also "z" and "Z" give the
name of the timezone instead of the timezone offset (i.e. -0500). In
searching for these in our code base, I found that the only ones we use
are %e, %l, %k, and %z.

Now for %e, %l, and %k, in Windows you can use the "#" prefix which
tells it to strip leading zeroes. So the equivalents are %e => %#d; %l
(lowercase L) => %#I (uppercase I); %k => %#H. *However*, the "#"
doesn't work in Linux. So you have to use a different language string
for each platform.

One way to handle this is with local language string overrides. However,
I also noticed that Mahara already contains code to do the Windows
workarounds, but it's incomplete. All the date formats that are stored
in language strings, are normally called using the Mahara function
format_date() in htdocs/lib/mahara.php. This method actually already
contains code to detect Windows and swap "%e" for "%#d". So you could
try adding additional code there to make the other substitutions as
well.

(I noticed that ADODB and Dwoo also include code that does this same
substitution, but I don't think it's meant to be part of their external
API, so it's probably better not to swap out for that.)

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1451328

Title:
  Timezone identifier support for PHP on Windows

Status in Mahara ePortfolio:
  Triaged

Bug description:
  Last login column for users search is blank (and does not sort in the
  correct order) also the warning saying 'PHP on your website host does
  not return a useful value for the timezone identifier (%z) .....' on
  the admin page is not a fix for the problem and unfortunately some of
  us are not able to change from hosting on a Windows server.

  I am wondering if Mahara is using strftime resulting in the time zone
  identifier returning 'New Zealand Standard Time' in Windows rather
  than Linux' +1200 is part of the problem.

  I have searched the forums but not found a fix.

  Server: Windows 2012 R2
  Mahara version: 15.04.0 and 1.9.4
  IIS: 8.5 (both servers) also had same problem on a WAMP environment
  PHP version: 5.5.3 and 5.5.8
  MySQL version: 5.5.40 on both servers

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1451328/+subscriptions


References