I\'m looking for a workaround or hive date functions that gives day of the week ,
Sunday - 1
Monday - 2
Tuesday - 3
Wednesday - 4
Thursday - 5
Friday - 6
Sat
As I said you need to write a UDF which will accept a string as parameter and return a string. Inside the UDF you need to do these steps:
1.) Parse the input string using SimpleDateFormat(YYYYMMDD)
2.) Use the Below code to get the day of week:
Calendar c = Calendar.getInstance();
c.setTime(yourDate);
int dayOfWeek = c.get(Calendar.DAY_OF_WEEK);
3.) Use this dayOfWeek value in a case statement to get your weekday String and return that string.
Hope this helps...!!!