date command in Linux with Examples

date command means Display the system date and time in Linux.

Syntax

date [OPTION]… [+FORMAT]
date [-u|–utc|–universal] [MMDDhhmm[[CC]YY][.ss]]

In man page the describe it

  • date – print or set the system date and time.
  • man date– More details information about date command.

date command in Linux with Examples

$ date

Get year month day

[huupv@huupv devopsroles]$ date +%Y-%m-%d
2019-03-10

Get date command usage in Linux

[huupv@huupv devopsroles]$ date -d now
Sun Mar 10 13:18:55 +07 2019
[huupv@huupv devopsroles]$ date -d tomorrow
Mon Mar 11 13:19:00 +07 2019
[huupv@huupv devopsroles]$ date -d yesterday
Sat Mar  9 13:19:06 +07 2019
[huupv@huupv devopsroles]$ date -d last-sunday
Sun Mar  3 00:00:00 +07 2019
[huupv@huupv devopsroles]$ date +'%Y-%m-%d'
2019-03-10

Conclusion

date command is the simple the command in Linux. It is the most popular in use terminal Linux print or set the system date and time.

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created DevopsRoles.com site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

1 thought on “date command in Linux with Examples

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment moderation is enabled. Your comment may take some time to appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.