date command in linux

 

date command – This command is use to display the system date and time. And also you can set date and time of system.

# date

Sat Mar 23 22:52:55 IST 2019


Set date and time of system

# date -s "Mar 23 2019 22:54:50"

Or,

# date --set "Mar 23 2019 22:54:50"


Print current year

# date +%Y

2019


Print current month

# date +%m


Print current month of date

# date +%d

23


Print current time

# date +%T

22:58:27


Print today Year, Month, Day

# date +%Y-%m-%d

2019-03-23


Print today Year, Month, Day and Time

# date "+%Y-%m-%d %T"

2019-03-23 23:00:38


Print time zone in Alphabetic

# date "+%Y-%m-%d %T %Z"

2019-03-23 23:06:56 IST


Print time zone in Numeric

# date "+%Y-%m-%d %T %z"

2019-03-23 23:07:34 +0530

Share on Google Plus

About Penguin Technology

I am a passionate cloud and DevOps professional specializing in Linux and open-source solutions. Through this blog, I share my knowledge and experience with the community, offering tips and insights on cloud technologies and DevOps practices.
    Blogger Comment

0 comments:

Post a Comment