- Join BJ's Wholesale Club for $20, and get a $20 gift card: Deal
- Delivering better business outcomes for CIOs
- Docker Desktop 4.35: Organization Access Tokens, Docker Home, Volumes Export, and Terminal in Docker Desktop | Docker
- Cybercriminals Exploit DocuSign APIs to Send Fake Invoices
- Your iPhone's next iOS 18.2 update may come earlier than usual - with these AI features
Displaying dates and times on Linux
$ date +%A Thursday
If you want the month spelled out fully, use a command like this one:
$ date +"%B %d" July 04
Looking forward in time
The date command also allows you to show dates in the future. While you likely know what day tomorrow is, you could use a similar command to display the current time but the next day.
$ date --date="tomorrow" Fri Jul 5 11:12:11 AM EDT 2024
This next command shows the day of the week 2 years in the future.
$ date +%A --date "2 year" Saturday
The next command shows the full date.
$ date --date="2 year" Sat Jul 5 11:14:07 AM EDT 2026
Looking backward in time
You can also use the date command to display dates and times in the past. The commands below show yesterday’s date, the date and time two hours ago and the day of the week from two years ago today.
$ date --date="yesterday" Wed Jul 3 11:19:02 AM EDT 2024 $ date --date "2 hour ago" Thu Jul 4 09:21:23 AM EDT 2024 $ date +%A --date "2 year" Saturday $ date --date="+7 days ago" Thu Jun 27 09:23:07 AM EDT 2024
Multi-line date info
If you want to display date and time information in a multi-line display, insert a newline (%n) string into your date command where the break should occur. Here’s an example: