Fix bug in hive with 24 hour timestamp.

This is a backport of:
https://issues.apache.org/jira/browse/HIVE-3850
Merge branch 'shark-0.9' of https://github.com/amplab/hive into shark-0.9-csd