Checks if this is less than or equal to date2, and swap the values if this is not the case.
date2
the first date
the second date