Fixed datetime conversion bugs.