Datetime and Date comparison
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Alteryx fails to correctly compare for equality datetime and date despite date->datetime conversion exists and after the conversion the comparison is done correctly. Am I missing something?
It looks like the comparison is done alphabetically (after -> to string conversion as a common type ???). I would prefer either 'invalid operator exception' or conversion to datetime as common type.
(I am guessing the alphabeticall comparison because [datetime]>[date]==true which is same behaviour as for string)
update: to make it more obvious - the question is why Alteryx even allows such comparison when it does not make any sense? (as I said "invalid operator" would make more sense than this result)
- Labels:
- Date Time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@atcodedog05
Now (after making mistake) I know I have to do type conversion to make the equality work (either to date -> datetime or datetime -> date).
Question is, why alteryx "allows" me to do direct comparison when the result does not make any sense?
That's imho faulty behavior. For example I cannot compare "1" and 1 (despite common type string exists) so why I can compare date and datetime when the comparison is done alphabetically??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @PaA
You look at date and datetime as Int and double
Int has no decimal similar way date does not have time.
Double has decimal similar way datetime has time.
Int and double are numeric datatypes. Values are similar only representation changes.
Date and Datetime are date datatypes. Values are similar only representation changes.
Hope this helps : )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @atcodedog05
And in what language does 1 (int) != 1.0 (double) ? Either it is cast exception or there is autocast and result is true.
That's what I am trying to say either the types should be uncomparable or the result should be true.
