On Monday, 7 October, 2019 07:17, Jose Isaias Cabrera <jic...@outlook.com> 
wrote:

>I have to ask this question:  Why is it that the date function does not
>take a '4/5/2019' and returns '2019-04-05'?  

Because it does not.  Humans read things in big endian order.  For example, in 
the common base 10 system used everywhere in this solar system, the left most 
position contains the biggest thing, with the bigness represented by each digit 
decreasing by a factor of 10 as you travel from left to right.  When you are 
talking about datetime, the biggest thing is the year, then the month, then the 
day, then the hour, then the minute, then the seconds and fractions thereof.  
Therefore, having datetimes in "parts are in descending order of bigness" is 
rational, consistent, cannot be misinterpreted, and requires no external 
rosetta stone for interpretation of the various parts.

How confusing would it be if one million four hundred thirty seven thousand six 
hundred and forty two were written as 4371426?

>This may have been asked
>before, and the answer may be some where in the internet, but, I could
>not find it.  The other thing is that it would be nice to have date take
>something like this,

>date('2/15/2019','m/d/yyyy')

This is exactly why.  Because the format is ambiguous and requires the input of 
an external rosetta stone key for decoding, such formats are not used.

>and return

>2019-02-15
>
>so I don't have to deal with the changes. :-)  Just wishing out-loud...

You can always write an extension function that translates between arbitrary 
datetime or number formats into standardized format, or use the built-in 
capabilities of your programming language standard library or Operating System 
to do that before you pass the data to SQLite3 in the format that it requires.  
Just as SQLite3 does not recognize the string 4371426 as a valid representing 
of the number 1437642, it does not recognize that 4/5/6789 is 6789-04-05 (or is 
that 6789-05-04, or is it 04-6789-05 in the Alpha Centauri calendar?).

-- 
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume. 



_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to