Open
Description
Submitted by: @ibprovider
string_to_datetime has following code for correction of y2k problem (two-digit year):
tm times2;
Firebird::TimeStamp::getCurrentTimeStamp\(\)\.decode\(×2\);
// Handle defaulting of year
if \(description\[position\_year\] == 0\) \{
times\.tm\_year = times2\.tm\_year \+ 1900;
\}
else if \(description\[position\_year\] <= 2\)
\{
// Handle conversion of 2\-digit years
if \(times\.tm\_year < \(times2\.tm\_year \- 50\) % 100\)
times\.tm\_year \+= 2000;
else
times\.tm\_year \+= 1900;
\}
times\.tm\_year \-= 1900;
times\.tm\_mon \-= 1;
---
This code looks to the CURRENT year, but adjust the two-digit year number on 1900 or 2000.
When current year will be more than 2050, this code will return strange result.