Show The Day of A Week in Linux
Today is my son’s birthday, and we had a great party with many friends. We’ve been lucky to have his birthday on Sunday this year. Here’s a simple enough way of checking wich day of a week any day will be.
Show Current Day of The Week
date command has a special format code that shows current day of the week: %a for short name (like Sat or Sun) and %A for full name (like Saturday or Sunday).
Just typie it like this to confirm today’s day of the week:
greys@xps:~ $ date '+%a' Sun greys@xps:~ $ date '+%A' Sunday
Show Day of the Week For a Specific Date
The same date command has another great option: using -d you can specify any date, so the date command will confirm the day of the week for it.
Here’s how you can check which day of the week it will be on September 15th next year:
greys@xps:~ $ date '+%A' -d 2020-09-15