Another approach is to use pattern matching. Say you're using Timex, which uses a %DateTime{}
struct, and you want to see if an element is one. You can find a match using pattern matching in the method.
def is_a_datetime?(%DateTime{}) do
true
end
def is_a_datetime?(_) do
false
end