Sort date and time and state for events