Agenda is to enlist and explore all the date command options.
date command is used to display the system date and time. date command is also used to set date and time of the system. By default the date command displays the date in the time zone on which linux operating system is configured. You must be the root to change the date and time.
1:) expore the manual of Date command using “man date”
2:) date command just showns date and time
3:) To edit existing Date to another date
date — date=”dd/mm/yyyy”
— date (abbreviated as -d) Option: Displays the given date string in the format of date. But this will not affect the system’s actual date and time value .Rather it uses the date and time given in the form of string.
4:) date — set=”your new date and time”
its used to set the system date and time
5:)date — file=”Path/TO/DateFile”
the date file not available
— file or -f Option: used to display the date string present at each line of file in the date and time format.This option is similar to –date option but the only difference is that in –date we can only give one date string but in a file we can give multiple date strings at each line.
watch date is used to see the live date and time .this option is similar to date command but the difference is watch date command shows live time with seconds running.
- %D : Display date as mm/dd/yy format.
8:)date “+%D %T”
%T is used display the time in 24 hours format as HH:MM:SS
9:)date “+%Y — %m-%d”
+%Y is used to display four-digit year
%m is used to display month of the year(01 to 12)
%d is used to display day of the month(01 to 31)
10:)date “+%A %B %d”
+%A is used to display full week days(sunday to saturday)
%B is used to display full month name (january to december)
%d is used to display the day of the month (01 to 31)
%T is used to display the time in 24 hour format as HH:MM:SS
%y is used to display last two digits of the year(00 to 99)
11:) date “+%H :%M :%S”
+%H is used to display the Hour
%M is used to display the minutes
%S is used to display the seconds
Thank you .