How to display the day of a previous date?

I am trying to display the day of a previous date and I am able to do this for the current date, but unable to use the date_sub function to get the day displayed of 3 days ago.

select from_unixtime(unix_timestamp(current_timestamp),'XXXX');
+-----------+--+
| _c0 |
+-----------+--+
| Tuesday |
+-----------+--+

select from_unixtime(unix_timestamp(date_sub(current_timestamp,3)),'XXXX');
+-------+--+
| _c0 |
+-------+--+
| NULL |
+-------+--+
Is there another way of achieving this?
Thanks in advance.

Tagged:
Sign In or Register to comment.