date's Examples

this command is used to dispaly date and time of the system

$date

display the weekday for that date

$ date -d "1992-04-23"

dispalys the week and the year

$ date +"week:%V year:%y"

displays the date in the next year

$ date -d next-year

displays the date in the next year

$ date -d next-year

calculate epoch time

$ date +%s

gives poin of time at the partucular date

$ date -d "1997-04-23" +"%s"

you can get the tiime zone

$ TZ=PDT date

set the time to given date

$ date --set "20190101 11:00"

gives week and weekday and month and year

$ date +"week:%V weekday:%A month:%B year:%y"

gives the specific weekday for the date

$date -d "2023-08-23" +"%A"

gives the error invalid date

$ date -d "15-01-2023"

prints the whole year caleder of 2012

cal 2012

prints the august 2019 calender

cal 08 2019

prints 2025 calender

cal 2025

DevOpsSchool
Typically replies within an hour

DevOpsSchool
Hi there 👋

How can I help you?
×
Chat with Us