Based on the example mentioned here in the Snowflake documentation, why are the date and timestamp values returning different values just by changing the ORDER BY clause? Also, I am trying to convert a string to a date format which is not returning correct results in Snowflake while this works fine in other SQL based Engines. Need help from experts on this.
This query
SELECT '20200710', TO_DATE('20200710');
is returning the following output
20200710 | 1970-08-22
Also tried:
SELECT TO_DATE('20200710', 'YYYY-MM-DD');
and got the error:
Can't parse '20200710' as date with format 'YYYY-MM-DD'
SELECT TO_DATE('20200710', 'YYYYMMDD');
- the format is for the incoming string, not the output format. It returns aDATE
type which doesn't actually have a "format" like you think. I have no idea why the first example is behaving the way it is - that makes no sense. You mentionORDER BY
in part of your question, but don't provide any examples, so not sure what you're on about? – Clockwork-MuseORDER BY
, yields undefined results. Given this, I would avoid this product in favor of something else. – Clockwork-Muse