What are other date command options?

0101

The date command has several options for formatting the output. Here are some commonly used options:

  1. Display the current time:

    date +%T

    Output: 14:30:00 (HH:MM:SS format)

  2. Display the full date and time:

    date +"%Y-%m-%d %H:%M:%S"

    Output: 2023-10-20 14:30:00

  3. Display the day of the week:

    date +%A

    Output: Friday

  4. Display the month name:

    date +%B

    Output: October

  5. Display the Unix timestamp:

    date +%s

    Output: 1697815800 (number of seconds since Jan 1, 1970)

  6. Custom format:
    You can combine format specifiers. For example:

    date +"Today is %A, %B %d, %Y"

    Output: Today is Friday, October 20, 2023

For a complete list of options, you can check the manual page by running:

man date

Let me know if you need more information!

0 Comments

no data
Be the first to share your comment!