date command in Linux with Examples

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

date command in Linux with Examples

Syntax

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

In the man page, the describes 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
date command in Linux with Examples

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 a simple command in Linux. It is the most popular in use terminal Linux print or set the system date and time. Thank you for reading the DevopsRoles page!

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 *

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