Convert Date of Birth into Age in Spark Dataframe API

前端 未结 4 1884
被撕碎了的回忆
被撕碎了的回忆 2021-01-16 08:16

This seems simple but I couldn\'t find the answer. I\'m trying to convert a column of date-of-birth in the below date format to the date format in Spark Dataframe API and th

4条回答
  •  迷失自我
    2021-01-16 08:36

    select datediff(current_date(),
             TO_DATE(CAST(UNIX_TIMESTAMP(dateOfBirth,'yyyy-MM-dd') AS TIMESTAMP)))/365 as age
      from 
    

提交回复
热议问题