codecraker
codecraker

Reputation: 47

convert date to midnight in hive

I want to truncate a specific date to midnight time in hive. I have tried the following below, but it puts 12 hour time instead of 00.

date_format(MIN(date_and_time), 'yyyy-MM-dd hh:00:00.000')

Result obtained

2021-11-03 12:00:00.000

Any suggestions on that?

Thank you

Upvotes: 1

Views: 178

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269773

Use HH for a 24-hour clock:

date_format(MIN(date_and_time), 'yyyy-MM-dd HH:00:00.000')

Upvotes: 3

Related Questions