Explore date command and with options and try to use every option and create a simple document for it.
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 unix/linux operating system is configured. You must be the super-user (root) to change the date and time.
FORMAT controls the output. Interpreted sequences are:
▪date +%a Displays weekday in short name (e.g., Sun)
▪date +%A Displays full weekday name (e.g., Sunday)
▪date +%b Displays month name in short form (e.g., Jan)
▪date +%B Displays full month name (e.g., January)
▪date +%c Displays date and time (e.g., Fri Sep 3 23:05:25 2021)
▪date +%C Displays century, except omit last two digits (e.g., 20)
▪date +%d Displays day of month (e.g., 24)
▪date +%D Displays date same as %m/%d/%y(month/date/year) (e.g.,09/24/2021)
▪date +%e Displays day of month same as command %d (e.g.,24)
▪date +%F Displays full date; same as %Y-%m-%d(Year/Month/date) (e.g.,2021/09/24)
▪date +%g Displays last two digits of year (e.g.,21)
▪date +%G Displays year (e.g.,2021)
▪date +%h Displays month in short form same as %b (e.g., Jan)
▪date +%H Displays hour (00..23)
▪date +%I Displays hour (01..12)
▪date +%j Displays day of year (001..366)
▪date +%m Displays month (01..12)
▪date +%M Displays minute (00..59)
▪date +%n Displays shifts to a newline
▪date +%N Displays nanoseconds (000000000..999999999)
▪date +%p Displays either AM or PM based upon time
▪date +%q Displays quarter of year (1..4)
▪date +%r Displays locale’s 12-hour clock time (e.g., 11:11:04 PM)
▪date +%R Displays 24-hour hour and minute which is same as %H:%M
▪date +%s Displays seconds since 1970–01–01 00:00:00 UTC
▪date +%S Displays second (00..60)
▪date +%t Displays a tab by adding new tab
▪date +%T Displays time which is same as %H:%M:%S e.g.,22:19:01
▪date +%u Displays day of week (1..7); 1 is Monday
▪date +%U Displays week number of year, with Sunday as first day of week (00..53)
▪date +%V Displays week number, with Monday as first day of week (01..53)
▪date +%V Displays week number, with Monday as first day of week (01..53)
▪date +%w Displays day of week (0..6); 0 is Sunday
▪date +%W Displays week number of year, with Monday as first day of week (00..53)
▪date +%x Displays date representation (e.g., 12/31/99)
▪date +%X Displays time representation (e.g., 23:13:48)
▪date +%y Displays last two digits of year (00..99)
▪date +%Y Displays year
▪date +%z Displays time zone hhmm (hourminute) (e.g., +0530)
▪date +%:z Displays time zone hh:mm(hour:minute)(e.g., +05:30)
▪date +%::z Displays time zone hh:mm:sec(hour:minute:seconds) (e.g.,+05:30:00)
▪date +%Z Displays alphabetic time zone abbreviation (e.g., IST)
Thanks for reading !!!