Introduce datetime_filter to DRY code.

Also clarified a few statements.