date_sub(timestamp startdate, int days), Purpose: Subtracts a specified number of days
from a TIMESTAMP value. The first argument can be a string, which is
automatically cast to TIMESTAMP if it uses the recognized format, as
described in TIMESTAMP Data Type. Return type: timestamp
我们有
current_timestamp() Purpose: Alias for the now() function. Return
type: timestamp
您可以轻松地执行此任务,有许多与日期相关的方法,您可以在这里使用
date_sub
关于Spark REPL的示例:
你可以试试
我也不知道spark,但我在谷歌上找到的。 您也可以使用这个link作为参考
算术函数允许您对包含日期的列执行算术运算。
例如,您可以计算两个日期之间的差异、向日期中添加天数或从日期中减去天数。内置的日期算术函数包括} 、
datediff
、date_add
、^{add_months
、last_day
,next_day
,和months_between
。我们需要的是
我们有
你可以选择
见https://spark.apache.org/docs/1.6.2/api/java/org/apache/spark/sql/functions.html
相关问题 更多 >
编程相关推荐