Fix get_datetime function.