Nigel Thomas 35 Posted February 2, 2023 DateUtils.IsValidDate checks if the Year is <= 9999. This means the test will fail in the year 10000 and forward. Shouldn't it be fixed now, to avoid a new "Millenium Bug" panic? Share this post Link to post
programmerdelphi2k 237 Posted February 2, 2023 (edited) Independent of the System.DateUtils functions, I have tested the minimum and maximum value accepted by Delphi to inform a valid date and time, being: Delphi: of course, all should knows it Min: 30/12/1899 12:00 AM Max: 31/12/9999 23:59:59.999 TDateTime var using a "double" value directly Min: 01/01/0001 00:00:00.001 = -693593.00000001 = 693,593 days = 1900 years Max: 12/31/65535 23:59:59.990 = +669528949.999999940 = 23,920,275 days = 65,535 years Total: 24,613,868 days = 67,435 years then, the limitation is just from Delphi procedure! using TDatePicker (MSWin10 component) = Min: 01/01/0001 Max: 12/31/9999 = 64bits using TDateTimePicker = Min: 01/01/1601 Max: 12/31/9999 = 32bits NOTE: in function to Date/time, Delphi use "look" just first 4 digits for "years", then, the year "65535" stay as "6553"! here is the limitation! Edited February 2, 2023 by programmerdelphi2k 1 Share this post Link to post
Ian Branch 127 Posted February 2, 2023 I was there for Y2K. Not sure I will be around for Y10K... 😉 3 Share this post Link to post
David Heffernan 2345 Posted February 2, 2023 5 hours ago, Nigel Thomas said: DateUtils.IsValidDate checks if the Year is <= 9999. This means the test will fail in the year 10000 and forward. Shouldn't it be fixed now, to avoid a new "Millenium Bug" panic? No. 1 Share this post Link to post
Fr0sT.Brutal 900 Posted February 2, 2023 Not only this function... just think about all these dd-mm-yyyy patterns that will break Share this post Link to post
Attila Kovacs 629 Posted February 2, 2023 That's why I'm using stardate.pas 1 1 Share this post Link to post
Alexander Elagin 143 Posted February 2, 2023 There is a nice RFC 2550 dealing with dates up to year 10E30 and beyond (dated 1 April 1999 ) 1 Share this post Link to post
Sherlock 663 Posted February 2, 2023 3 hours ago, David Heffernan said: No. To elaborate on this correct and concise answer: One should only fix things that a really broken or occur during the life cycle of the software. You simply cannot think of all eventualities - one of them being: will there still be a Delphi compiler in the year 9999? If not, how can I make sure that my code can still be compiled? Are we all gonna die? OMG! Panic! Enter into catatonic state now. To use popular acronyms: This is both YAGNI and KISS. Share this post Link to post
Uwe Raabe 2057 Posted February 2, 2023 11 hours ago, Nigel Thomas said: DateUtils.IsValidDate checks if the Year is <= 9999. The underlying reason is the Windows date format being limited to four digits Share this post Link to post
David Heffernan 2345 Posted February 2, 2023 1 hour ago, Sherlock said: To elaborate on this correct and concise answer: One should only fix things that a really broken or occur during the life cycle of the software. You simply cannot think of all eventualities - one of them being: will there still be a Delphi compiler in the year 9999? If not, how can I make sure that my code can still be compiled? Are we all gonna die? OMG! Panic! Enter into catatonic state now. To use popular acronyms: This is both YAGNI and KISS. I definitely hope that no Delphi code is running by 9999. I'd be amazed if there were any humans left on the planet when that year comes around. Share this post Link to post
Stefan Glienke 2002 Posted February 2, 2023 1 minute ago, David Heffernan said: I'd be amazed if there were any humans left on the planet when that year comes around. Planet of the Firemonkeys? 1 3 Share this post Link to post
Rollo62 536 Posted February 2, 2023 10 hours ago, Ian Branch said: I was there for Y2K. Not sure I will be around for Y10K... 😉 If there will be any issues in the future, I'm very sure I can fix them the day after Share this post Link to post
David Heffernan 2345 Posted February 2, 2023 16 minutes ago, Stefan Glienke said: Planet of the Firemonkeys? Yeah, defo Share this post Link to post
programmerdelphi2k 237 Posted February 2, 2023 for sure, this will be the new "visual" for "Nigel 10K" Share this post Link to post
Fr0sT.Brutal 900 Posted February 2, 2023 19 minutes ago, Stefan Glienke said: Planet of the Firemonkeys? Riding Firebirds 🙂 Share this post Link to post
Alexander Elagin 143 Posted February 3, 2023 Quoting the aforementioned RFC 2550: Quote There are a number date comparison problems that are beyond the scope of this specification. (...) 3) Continued existence of Earth-centric time periods (year, day, etc.) are problematical past the up-coming destruction of the solar system (5-10 billion years or so). The use of atomic-time helps some since leap seconds are no longer an issue. 4) Future standards and methods of synchronization for inter-planetary and inter-galactic time have not been agreed to. 5) Survivability of dates past the end of the universe is uncertain. Share this post Link to post
Lars Fosdal 1792 Posted February 3, 2023 The next Y2K like problem is already in 2038, when the 32-bit int that holds a Unix timestamp wraps to a negative number. Aka The Epochalypse. Share this post Link to post