Get the locale’s full weekday name for the 25th of December in the current year.
The -d option allows you to pass a string which alters the usual output value. Legal strings include (but are not limited too) "DDMMM" and "MMMDD".
The + option allows you to pass a string which alters the usual output format. Legal strings can be composed of normal text and symbols below which are expanded by the command:
%A = Locale’s abbreviated weekday name (e.g. Sun).
%A = Locale’s full weekday name (e.g. Sunday).
Pros: Month names are case insensitive. Space between date and month is optional. The date can be written before or after the month.
What Day of the Week was New Year’s Day This Year?
date -d "1 jan" "+%A" date -d "jan 1" "+%A" date -d "1/1" "+%A"
Get the locale’s full weekday name for the 1st of January in the current year.
Pros: Month names are case insensitive. Space between date and month is optional. The date can be written before or after the month.
What Day of the Week will New Year’s Day be Next Year?
date -d "1 jan next year" "+%A" date -d "jan 1 next year" "+%A" date -d "1/1 next year" "+%A"
Get the locale’s full weekday name for the 1st of January next year.
Pros: Month names and other words are case insensitive. Space between date and month is optional. The date can be written before or after the month.
What Day of the Week was it or will it be on ... ?
date -d "DDMMMYYYY" "+%A"
date -d "MMMDDYYYY" "+%A"
date -d "YYYY/MM/DD" "+%A"
date -d "YYYY-MM-DD" "+%A"
Get the locale’s full weekday name for day DD of month MM or MMM in year YYYY.
MMM is a short month name, e.g. Jan, Feb, Mar, etc.
MM is a 1- or 2-digit month number, e.g. 1 = Jan, 2 = Feb, 3 = Mar, 12 = Dec, etc.
The + option allows you to pass a string which alters the usual output format. Legal strings can be composed of normal text and symbols below which are expanded by the command:
%A = Locale’s abbreviated weekday name (e.g. Sun).
%A = Locale’s full weekday name (e.g. Sunday).
If "+%A" is omitted, the full date will be output.