I didn't find a post on this, but I was getting unexpected results in a formula where I was testing a date with the results of the DateTimeTrim function. It was resolving to false even thought the "date part" of the DateTimeTrim was the same as the date.
Try a simple formula like below and the boolean result is false.
"2016-01-01"=DateTimeTrim("2016-01-01","month")
Solved! Go to Solution.
DateTimeTrim("2016-10-23","month") =
DateTimeTrim("2016-10-31","month")
that will yield true
I suppose that
"2016-10"=
DateTimeTrim("2016-10-31","month")
will also yield true.
Alteryx treats Dates and DateTimes as strings. DateTimeTrim returns the value as a datetime string (i.e. with a trailing 00:00:00) so DateTimeTrim("2016-10-31","month") becomes "2016-10-01 00:00:00".
The easiest way I find to do a month comparison is:
LEFT("2016-10-31",7) == LEFT("2016-10-23", 7)
Very nice. I didn't know that they were treated as strings.
Can you change "lfet" to "left"? Then I can mark it as answered. Thanks again!
I think that it is safe to mark this as solved :P
Fixed :)
I know that this post is old but I found that I search for Date Time function help the most.
Nice to know that DateTimeTrim("2016-10-31",'month') works like DateTimeTrim("2016-10-31",'firstofmonth')
I was also able to get DateTimeTrim("2016-10-31",'day') to work also