Great question! The date command is quite powerful and can do more than just show the current date and time. You can format its output in many different ways.
Here are a few common options and examples to try in your terminal:
Display only the date (YYYY-MM-DD format):
date +%FYou'll see output like:
2025-12-16Display only the time (HH:MM:SS format):
date +%TYou'll see output like:
18:23:02Display a custom format (e.g., "Today is Tuesday, December 16, 2025"):
date +"Today is %A, %B %d, %Y"%Agives the full weekday name.%Bgives the full month name.%dgives the day of the month.%Ygives the four-digit year.
You can get very creative with these format specifiers!
Display UTC (Coordinated Universal Time):
date -uThis shows the current time in UTC, which is a global standard time.
Quick Challenge: Can you combine some of these format specifiers to display the date and time in a way that includes the day of the week, month, day, year, and then the time (HH:MM)?
You can find a full list of format specifiers by checking the date command's manual page. Try typing:
man date
Press q to exit the manual page. But don't worry about memorizing all of them now! Just playing around with a few can be a fun way to learn.
Let me know if you try any of these or want to explore other date command features!