Can anyone confirm the difference between gmdate() and gmstrftime()?

Can anyone confirm the difference between gmdate() and gmstrftime()?

by John Papaioannou -
Number of replies: 2
Hi all,

While busying myself with the way date/time things are handled inside Moodle (mainly to sort out the DST nightmare), I 've come to the tentative conclusion that:

date() and gmdate() interpret timestamps without taking the possible use of DST into account, while strftime() and gmstrftime() DO take the web server's DST settings into account

This is based on my own tests and the (not quite clear) comments that exist in the PHP documentation for the above functions. If this is true, then obviously each and every strftime() call in Moodle should be converted to the equivalent date() call. Otherwise, a parameter unknown at coding time (the DST settings of the user's web server) enters the calculations and makes the resulting date... non-deterministic. The core function usergetdate() currently suffers from this, among others. thoughtful

Can anyone confirm this to add some confidence to what I 'm doing?
Average of ratings: -
In reply to John Papaioannou

Re: Can anyone confirm the difference between gmdate() and gmstrftime()?

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
strftime on Win32 seems buggy/incomplete to me

echo 'strftime:'.strftime("%T-%e-%V-%D", time ()).'<br />';
displays as:
strftime:---

Am I doing something wrong??
In reply to Petr Skoda

Re: Can anyone confirm the difference between gmdate() and gmstrftime()?

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
No, you're not ... those libraries are buggy on Windows ... some of the code in userdate etc is a bit odd-looking precisely because I had to navigate around those holes ...