Fix Date and datetime conversion