title: Hive DateTime Truncators (QUARTER, WEEK, DAYOFWEEK)?
body: <p>Is there any expressions to get <code>QUARTER</code>, <code>WEEK</code> and <code>DAYOFWEEK</code> of a DateTime field in Hive (v0.14.1) which do the same thing as these buildin functions in MySql?</p>
  
  <p>here is the specification of what I want (from MySql doc):</p>
  
  <p><a href="https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_quarter" rel="nofollow">QUARTER</a>
  <a href="https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_week" rel="nofollow">WEEK</a>
  <a href="https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_dayofweek" rel="nofollow">DAYOFWEEK</a></p>
  
  <p>NOTE:
  1. the function quarter() was introduced in Hive 1.3, but I need a expr to support lower version.
  2. the function weekofyear() is supported instead of week(), but there is a little difference. but it's okay, so just ignore this one.</p>