Oh dear god this reminds me of that one nightmare I saw on another website...
The date "slider" which starts at an arbitrary starting date somewhere in 1970 and allows people to move the slider all the way up to 12/12/9999 or something like that.
A horrible abomination. Pretty sure it had to be a joke, but I have no way of knowing.
My only guess is that this somehow works out when you cast it to an unsigned int and it overflows back to the proper unix timestamp??? But that still doesnt make sense cuz this is the MIN date.... so maybe its a negative amount of time relative to when this is run, like the minimum date is 10 minutes ago or something dumb like that... -53690 is approx 15 hours assuming the unit is seconds.
It isn't necessarily a UNIX timestamp, for example on .NET the epoch starts on January 1 in the year 1 AD. And UNIX timestamps can be negative in some implementations.
It's microsoft SQL server, the dates and datetimes are internally stored as ints/decimals corresponding to the number of days since 1st Jan 1900(with datetime storing the fraction of a day for the time).
This means that casting dates/datetimes to floats/ints actually works as well as casting back so these numbers are just date offsets from 1900.
Absolutely doesn't excuse the nonsense of making the variables integers rather than datetime strings though. That's just weird.
96
u/--var Dec 15 '21
I'm glad this is commented, otherwise it would make no sense.
36
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Dec 15 '21
Image Transcription: Code
I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
36
u/MathewManslaughter Dec 15 '21
This is MySQL isnโt it? I have lots of bad memories of debugging strange ongoings and magic values in MySQL servers
153
u/ThePsion5 Dec 15 '21
Ah, I remember back in -37291, none of us even had cell phones back then!
2
u/RadioMelon Dec 27 '21
Oh dear god this reminds me of that one nightmare I saw on another website...
The date "slider" which starts at an arbitrary starting date somewhere in 1970 and allows people to move the slider all the way up to 12/12/9999 or something like that.
A horrible abomination. Pretty sure it had to be a joke, but I have no way of knowing.
50
u/EkskiuTwentyTwo i -= (i - (-1)) - i Dec 16 '21
At least they're in variables, rather than in code like:
14
u/[deleted] Dec 16 '21 edited Dec 16 '21
My only guess is that this somehow works out when you cast it to an unsigned int and it overflows back to the proper unix timestamp??? But that still doesnt make sense cuz this is the MIN date.... so maybe its a negative amount of time relative to when this is run, like the minimum date is 10 minutes ago or something dumb like that... -53690 is approx 15 hours assuming the unit is seconds.
Idk man, idk.
2
u/Flyberius Dec 16 '21
Old MS SQL.
I love it and miss it and I find postgres powerful but awkward.
1
u/kgon1312 Dec 16 '21
This is hell