bug fix on date time function.