0

In Impala, when I tried to compared the date, it will give wrong result. For example:

select 'Nov 23 2018  3:02AM' > 'Dec  1 2018 12:00AM'

which will return True

when use cast() function select cast('Dec 1 2018 12:00AM' as timestamp) which will give null. Thus, how can we compare the date in the format mm dd yy 00:00AM

user3651247
  • 238
  • 1
  • 7
  • 19

2 Answers2

0

You should use Impala implicit formating yyyy-MM-dd HH:mm:ss.SSS. In your case you should use for example

select cast('2018-11-23 03:02:00.000' as timestamp)
Radim Bača
  • 10,646
  • 1
  • 19
  • 33
0

You can use unix_timestamp(). I think the right format is:

select unix_timestamp('Nov 23 2018  3:02AM', 'MMM DD YYYY HH:mmPP')
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786