Close Menu
  • Analog Design
    • Latest Analog Layout Interview Questions (2025)
  • Digital Design
    • Digital Electronics Interview Question(2025)
    • Top VLSI Interview Questions
  • Physical Design
    • Physical Design Interview Questions for VLSI Engineers
  • Verilog
    • Verilog Interview Questions(2024)
  • Forum
Facebook Instagram YouTube LinkedIn WhatsApp
SiliconvlsiSiliconvlsi
Forum Questions Register in Forum Login in Forum
Facebook Instagram YouTube LinkedIn WhatsApp
  • Analog Design
    • Latest Analog Layout Interview Questions (2025)
  • Digital Design
    • Digital Electronics Interview Question(2025)
    • Top VLSI Interview Questions
  • Physical Design
    • Physical Design Interview Questions for VLSI Engineers
  • Verilog
    • Verilog Interview Questions(2024)
  • Forum
SiliconvlsiSiliconvlsi
Home»Linux»Linux date Command
Linux

Linux date Command

siliconvlsiBy siliconvlsiJanuary 22, 2024Updated:January 22, 2024No Comments2 Mins Read
Facebook Pinterest LinkedIn Email WhatsApp
Share
Facebook Twitter LinkedIn Pinterest Email

Linux date Command

Linux

The date command in Linux is a versatile tool used for displaying and setting the date and time. It also allows users to perform various operations related to date and time calculations.

Syntax:

date [OPTION]... [+FORMAT]
date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]

 

Example:

date -d "next Monday"

--debug: Annotate the parsed date and provide a warning about controversial usage to stderr.

-f or --file=DATEFILE: Similar to the ‘–date’ option.

-I[FMT] or --iso-8601[=FMT]: Display the date/time in ISO 8601 format.

Example:

date -Iseconds
date -r filename

Date command  Formatting Options

Here are some common formatting options that can be used with the +FORMAT argument:

  • %a: Abbreviated weekday name (e.g., Sun)
  • %A: Full weekday name (e.g., Sunday)
  • %b: Abbreviated month name (e.g., Jan)
  • %B: Full month name (e.g., January)
  • %c: Date and time (e.g., Thu Mar 3 23:05:25 2005)
  • %C: Century (e.g., 20)
  • %d: Day of the month (e.g., 01)
  • %D: Date (e.g., %m/%d/%y)
  • %e: Day of the month, space-padded (e.g., %_d)
  • %F: Full date (e.g., %Y-%m-%d)
  • %g: Last two digits of the year of ISO week number (see %G)
  • %G: Year of ISO week number (see %V)
  • %h: Abbreviated month name (similar to %b)
  • … and many more.

Examples of date command in linux

Basic Usage:

date

Custom Formatting:

date +'%A, %d %B %Y %T'

Displaying Previous Modification Time of a File:

date -r filename

Setting System Date and Time:

date --set="202012312359"

Displaying Epoch Time:

date +%s

Displaying ISO 8601 Date/Time:

date -Iseconds

Calculating Date (e.g., Next Monday):

date -d "next Monday"

Displaying RFC 3339 Date/Time:

date --rfc-3339=seconds

Setting Timezone:

TZ='India' date

Setting the system date and time using date directly is not recommended in production environments. The Linux system clock is usually synchronized using services like systemd-timesyncd or ntp.

The date command is a powerful tool for manipulating and displaying date and time information on a Linux system. It supports various formatting options, making it flexible for different use cases.

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email

Related Posts

Delete words after certain word in each line in gvim

January 28, 2024

What is a Linux locate Command?

January 22, 2024

du Command in Linux

January 20, 2024
Leave A Reply Cancel Reply

Facebook X (Twitter) Instagram Pinterest Vimeo YouTube
  • About Us
  • Contact Us
  • Privacy Policy
© 2025 Siliconvlsi.

Type above and press Enter to search. Press Esc to cancel.