Date Command In Linux
The date command is simple. However, it has several useful options that enhance it. It's also capable of giving you practical information about past or future dates.
date command is used to display the system date and time. date command is also used to set date and time of the system.
Basic Syntax for Date
The most basic syntax for the date command is simply to type in the command with no options and no format controls.
Use one or more format controls to display information. Here is the general syntax:
# date +%<format-option>
Let's look at a few examples.
Use Dashes(-) and Slashes(/) between the fields
we use date +"%Y-%m-%d" where %Y is for year ,%M for months and %dis for date,and in between we either use '-'or '/'.
Displaying the Year, Month, and Day fields labeled.
We can also labeled by writing date +"YEAR=%y,MONTH=%m,DAY=%d".
Set Coordinated Universal Time
we can print the universal time (UTC) by:-u, --utc, --universal
Display Outside Time Zone
Its really excitement to know what time would be there in other country whether there would be day or night etc.we can use cmd to know the diffrent time zone by TZ value with date command to diaplay the time and date information.
For Example:
Display Future and Past Time/Date:
If we have to organise a event on a particular date then we need to know to the day as mostly in india sunday is the free day for every family when every member of family can enjoy together.For Example:
Other Option
There are many more commands to get our desire output like :
Version
Last but not least to know about the version of date command.
Lastly i would like to thanks whole hartly to all the reader for giving their percious valuable time.Thank you......
Comments
Post a Comment