Reputation: 12041
Why are some options to date()
and strftime()
not supported on Windows? I though anything related to date is something that every system should support. Is it because of the way the date is internally stored?
Upvotes: 2
Views: 2578
Reputation: 449733
The manual on date() points out two differences:
and for strftime():
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, so your date range may be limited to no earlier than the Unix epoch. This means that %e, %T, %R and, %D (and possibly others) - as well as dates prior to Jan 1, 1970 - will not work on Windows, some Linux distributions, and a few other operating systems. For Windows systems, a complete overview of supported conversion specifiers can be found at » MSDN.
is that what you mean? Well, the reasons are explained there already, no support for negative timestamps. I don't think much can be done about that.
If that is giving you problems, you may want to go with a library like Zend_Date.
Upvotes: 6
Reputation: 19236
It's because date
and strftime
are just thin wrappers around underlying system functions, so that they accept only those functions that the operating system supports.
http://linux.die.net/man/3/strftime
http://msdn.microsoft.com/en-us/library/fe06s4ak%28VS.71%29.aspx
Upvotes: 0