adamsmith
adamsmith

Reputation: 5999

How to get the first day month of X months ago in Hive?

In Hive it's easy to get the day of X months later with add_months, but how do I do the opposite?
Is there something like this in Hive?
sub_months("2018-03-11", 4) == "2017-11-11"

Upvotes: 1

Views: 965

Answers (1)

HISI
HISI

Reputation: 4797

To get X months ago of a given month, you have just to add minus, for example:

select add_months('2018-03-11',-4);

Upvotes: 1

Related Questions