When I tried running timelocal(which, at least in Perl 5.005_03, requires "use Time::Local" with the same parameters as you, using a year of 51 and 53, both returned a timestamp of -1, indicating an illegal date - either before 1/1/1970, or after ?/?/2038.
I don't know why using 51 you don't get the 'Internal Error', but using 53 you do - it's irrelevant since in either case the return value you get is a -1 anyway. I have used Date::Manip, but not in a long time - I remember it being a very full featured date/time conversion program, but I can't confirm whether or not it would do what you're looking for, although I'd be surprised if it didn't.
One thing I remember about Date::Manip is that it can do nearly any date conversion you can think of, but it was admittedly(by the author) slow - again, this may have changed since I used it last. It would be fine for converting a small number of dates, but if you had to convert thousands or more dates, you might want to look for a faster alternative.
Thanks for answering. Actually, I had read about the "since 1970" part, but it worked for dd/mm/1953 so I forgot, and was curious as to why it wouldn't work for 1951.
Date::Manip will be fine for me since I only need to calculate maybe six or seven date values in the entire program. Of course, if the site is hit heavily there may be many instances of the program running at any given time, but each program instance will only involve a few manipulations so it will probably be fine.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.