Hacker News new | ask | show | jobs
by jsd1982 752 days ago
Just ran into a Y2038 bug in some classic ASP+VBScript code in production the other day. Someone long ago wrote `Date() + 5000` to set an expiry date far in the future (5000 days). As it turns out, 5000 days from now puts us past 1970-01-01 + 2**31 seconds (2038-01-19ish) and that causes VBScript to raise an error and abort the ASP page request with a 500 error.

I raised the issue that we have about 14 years left of ASP+VBScript literally being able to execute properly and calculate dates (sans any large date additions remaining). Guess it'll be sooner than that based on this post but 14 years is definitely the upper bound if your VBScript code even touches dates.

1 comments

Interesting that VBScript uses Unix time for timestamps. I would have expected something like FILETIME (NT's 1601 epoch) or OLE DateTime, which uses floating point with the integral part referring to days since 1899 and the fractional part is divided into the 24 hours of the day). Windows in general seems to have so many different date/time formats that using Unix time is quite surprising.