4 ms·
If they were stored as characters you could still do a string comparison using greater than and less than signs and logic. "202201010001" > "202112122359" eva
by frays 5y ago
If they were stored as characters you could still do a string comparison using greater than and less than signs and logic.
"202201010001" > "202112122359"
evaluates to True in Python, SQL and many other languages.
- oefnak 5y agoBut "1000"<"999" in Python.
- thomasfedb 5y agoBut the format and length for these numerical strings is fixed.
- jpambrun 5y agoThis is going to be a problem in about 8,000 years tho.
- laumars 5y agoString comparison works as long as you order your date time by significance and zero pad all values, which they were doing with their date stamp anyway. Plus if they weren’t then even numerical comparisons would fail eg 1012021 (Oct/1/2021) < 5102020 (May/10/2020) so you argument is moot.
- 6c696e7578 5y agoWouldn't it be done more like this though? "%04d%02d%02d" % (999,1,1)