Date issue in Windows

Found a bug? Tell us!!
Post Reply
tobias382
Posts: 3
Joined: Sat May 01, 2004 7:12 pm
Location: Lafayette, LA, USA
Contact:

Date issue in Windows

Post 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.
Matthew Turland
tobias382@yahoo.com
tomsommer
Core Developer
Posts: 240
Joined: Tue Sep 02, 2003 6:43 pm
Location: Denmark
Contact:

Post by tomsommer »

we cannot use date() since it ignores locales
Tom Sommer (Serendipity Core Developer)
http://blog.dreamcoder.dk
tobias382
Posts: 3
Joined: Sat May 01, 2004 7:12 pm
Location: Lafayette, LA, USA
Contact:

Post by tobias382 »

So there's no way to account for this particular nuance of Windows?
Matthew Turland
tobias382@yahoo.com
tomsommer
Core Developer
Posts: 240
Joined: Tue Sep 02, 2003 6:43 pm
Location: Denmark
Contact:

Post by tomsommer »

Is there not an equal to %e ? on windows?
Tom Sommer (Serendipity Core Developer)
http://blog.dreamcoder.dk
tobias382
Posts: 3
Joined: Sat May 01, 2004 7:12 pm
Location: Lafayette, LA, USA
Contact:

Post by tobias382 »

As far as I can tell, the PHP documentation doesn't mention any Windows alternative.
Matthew Turland
tobias382@yahoo.com
Post Reply