티스토리 뷰

공부

[spark] sql MONTHS_BETWEEN(a, b) -> a - b

승가비 2023. 2. 26. 11:43
728x90
> SELECT months_between('1997-02-28 10:30:00', '1996-10-30');
 3.94959677
> SELECT months_between('1997-02-28 10:30:00', '1996-10-30', false);
 3.9495967741935485

https://docs.databricks.com/sql/language-manual/functions/months_between.html

 

months_between function | Databricks on AWS

Returns the number of months elapsed between dates or timestamps in expr1 and expr2. Returns A DOUBLE. If expr1 is later than expr2, the result is positive. If expr1 and expr2 are on the same day of the month, or both are the last day of the month, time of

docs.databricks.com

 

728x90
댓글