Date — The Command

  • date command:- The simple date command will show you the current date and time of the system.
  • man date command:- Basically, man command or manual command is a built-in manual for using Linux commands It allows users to view the reference manuals of a command or utility run in the terminal.
  • %D – Display date as mm/dd/yy
  • %Y – Year (e.g., 2020)
  • %m – Month (01-12)
  • %B – Long month name (e.g., November)
  • %b – Short month name (e.g., Nov)
  • %d – Day of month (e.g., 01)
  • %j – Day of year (001-366)
  • %u – Day of week (1-7)
  • %A – Full weekday name (e.g., Friday)
  • %a – Short weekday name (e.g., Fri)
  • %H – Hour (00-23)
  • %I – Hour (01-12)
  • %M – Minute (00-59)
  • %S – Second (00-60)

Set or Change Date in Linux

date --set="20100513 05:30"

Display Past Dates

date --date="2 year ago"

Display Future Dates

date --date="next monday"

Override a Time Zone

TZ='America/New_York' date

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store