Fixed datetime condition generation