FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » mktime 2-digit vs 4-digit year
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: mktime 2-digit vs 4-digit year [message #175218 is a reply to message #175216] Fri, 26 August 2011 23:14 Go to previous messageGo to previous message
A is currently offline  A
Messages: 17
Registered: June 2011
Karma:
Junior Member
> the mktime() year argument expects an integer
> how does it know if I passed a 2-digit vs 4 digit value?
> testing 0 <= year < 100 simply isn't good enough... what If I want to
> specify years 0000 - 0099 (which should be possible on a 64-bit
> system)

mktime was not designed to do that. 0-99 are interpreted as 2 digits. mktime
accepts 2 or 4 digit year. valid range is from 1901 and 2038 on 32-bit
system so you can't even interpret anything outside of that range. it is
Year 2038 problem - http://en.wikipedia.org/wiki/Year_2038_problem

for anything outside of that range you probably need to make your own
library.

> And if it does correctly accept the year 0000 - 0099, how could my own
> code distinguish between 0000 and 00 ?

You can't. 0000 == 00. so 00 - 99 is simply an alias for 1900-1999.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Top 10 Wrong Ideas About PHP
Next Topic: fopen error
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 16:44:50 GMT 2024

Total time taken to generate the page: 0.03980 seconds