Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the weekday of a day in ubuntu terminal

How do I get the weekday from a date in the ubuntu terminal?

For example I type in: 1990-01-22, I want to get an output that says for example Thursday if 22th day was a thursday.

like image 662
user3460769 Avatar asked Mar 20 '23 02:03

user3460769


1 Answers

Use %A:

$ date -d"1990-01-22" "+%A"
Monday

From man date:

   %A     locale's full weekday name (e.g., Sunday)
like image 140
fedorqui 'SO stop harming' Avatar answered Mar 25 '23 09:03

fedorqui 'SO stop harming'