How to get the Date of the first day of a week given a time stamp in Hadoop Hive?
问题 Besides writing a custom UDF to support this issue, is there any known methods of achieving this? I'm currently using Hive 0.13. 回答1: date_sub(m.invitationdate,pmod(datediff(m.invitationdate,'1900-01-07'),7)) This expression gives the exact solution to my question. Regards, Boris 回答2: This is the easiest and the best solution for fetching 1st day of the week's date: For Current timstamp: select date_sub(from_unixtime(unix_timestamp()), cast(from_unixtime(unix_timestamp(), 'u') AS int)) ; For