title: Spark - Datediff for months?
body: <p>Is there a good way to use <code>datediff</code> with months? To clarify: the <code>datediff</code> method takes two columns and returns the number of <em>days</em> that have passed between the two dates. I'd like to have that in <em>months</em>. I want to have a parameter in my function that can I tell to check data say from the last 20, 36, whatever months. If I just do datediff and divide the result with 30 (or 31), than the result is not quite accurate. I could use 30.4166667 (= 365 days/12 months), but that is not quite accurate either for shorter periods. So, any tips on how to use <code>datediff</code> to be able to get months out of it? SQL has it like <code>SELECT DATEDIFF(month, '2005-12-31 23:59:59.9999999', '2006-01-01 00:00:00.0000000');</code>, I'm looking for something like this in Spark.</p>