Hive – Timestamp format

Yesterday in a format like ‘20140101’


Versus the dumb version:

10000*year(from_unixtime(unix_timestamp())) + 100*month(from_unixtime(unix_timestamp())) + 1*day(from_unixtime(unix_timestamp()))

As you can see from the date functions in Hive documentation, where M actually stands for month in Hive where it stands for minute in POSIX..

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s