If you want to determine the day of the week for a specific date on a Lunux system, you can provide that date as a parameter to the
date
command with --date
.
-d, --date=STRING display time described by STRING, not 'now'
E.g., to determine the day of the week for August 10, 2008, you could use the following command at a Bash prompt:
$ date --date=2008-08-10 Sun Aug 10 00:00:00 EDT 2008
If you only want to see the day of the week, e.g., day 7, "Sun", or "Sunday", then you can provide a format parameter as well as shown below:
$ date '+%u' --date=2008-08-10 7 $ date '+%a' --date=2008-08-10 Sun $ date '+%A' --date=2008-08-10 Sunday
The format values used above are as follows:
%a locale's abbreviated weekday name (e.g., Sun) %A locale's full weekday name (e.g., Sunday) %u day of week (1..7); 1 is Monday