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 will it be on a Certain Date?
date -d "DDMMMYYYY" "+%A" date -d "MMMDDYYYY" "+%A"
Get the locale’s full weekday name for day DD of month MMM in year YYYY.
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).