title: Hive: Subtracting 1 year from current date
body: <p>I'm trying to find the best way to subtract 1 year and also one month from the current date in a Hive query. Using the following, I don't believe it will take into account leap years or if the fact that months have different amounts of days so eventually the code will break. Any help would be greatly appreciated! </p>
  
  <pre><code>set my_date = from_unixtime(unix_timestamp()-365*60*60*24, 'yyyy-MM-dd');
  set my_date = from_unixtime(unix_timestamp()-30*60*60*24, 'yyyy-MM-dd');
  </code></pre>
  
  <p>Thank!</p>
  
  <p>-Rebecca</p>