Page 1 of 1

Date issue in Windows

Posted: Sat May 01, 2004 7:26 pm
by tobias382
From what I gather from the web site, this software is designed more for a Linux environment than a Windows one. Nevertheless, I've found it to work fairly well on Windows, with one small exception.

"Note: Not all conversion specifiers may be supported by your C library, in which case they will not be supported by PHP's strftime(). Additionally, not all platforms support negative timestamps, therefore your date range may be limited to no earlier than the Unix epoch. This means that e.g. %e, %T, %R and %D (there might be more) and dates prior to Jan 1, 1970 will not work on Windows, some Linux distributions, and a few other operating systems."
-- http://us3.php.net/strftime

This appears to be true, as I'm running Serendipity 0.6rc2 on Windows XP, Apache 1.3.29, and PHP 4.3.6rc3, and the date appears as though the %e portion of the DATE_FORMAT_ENTRY constant declared in the language file wasn't present there...

Saturday, May . 2004

I got around it by opening up the language file (in my case lang/serendipity_lang_en.inc.php) and changing this line...

$d = ucfirst(strftime(DATE_FORMAT_ENTRY, $entries[$x]['timestamp']));

... to this...

$d = date("l, F j, Y", $entries[$x]['timestamp']);

A pretty "dirty" way to do it, I know, but it seems to do the job. I'm unsure of what considerations there were when it was decided to use the strftime() function for timestamp formatting, but if there's no specific reason why the date() function wasn't used instead, it might be worthy of consideration.

Posted: Sat May 01, 2004 8:30 pm
by tomsommer
we cannot use date() since it ignores locales

Posted: Sun May 02, 2004 12:27 am
by tobias382
So there's no way to account for this particular nuance of Windows?

Posted: Sun May 02, 2004 12:30 am
by tomsommer
Is there not an equal to %e ? on windows?

Posted: Sun May 02, 2004 2:00 pm
by tobias382
As far as I can tell, the PHP documentation doesn't mention any Windows alternative.