____     __                            ______                ___
/\  _`\  /\ \             __           /\__  _\              /\_ \               not logged in: Guest
\ \ \/\_\\ \ \___   _ __ /\_\    ____  \/_/\ \/   ___     ___\//\ \    ____
 \ \ \/_/_\ \  _ `\/\`'__\/\ \  /',__\    \ \ \  / __`\  / __`\\ \ \  /\_ ,`\
  \ \ \L\ \\ \ \ \ \ \ \/ \ \ \/\__, `\    \ \ \/\ \L\ \/\ \L\ \\_\ \_\/_/  /_
   \ \____/ \ \_\ \_\ \_\  \ \_\/\____/     \ \_\ \____/\ \____//\____\ /\____\
    \/___/   \/_/\/_/\/_/   \/_/\/___/       \/_/\/___/  \/___/ \/____/ \/____/

  Home   Links   Searches   Pages   Helps 

Page ID: Bash date() options  


Linux date Command Output Format Options

The format specifiers allow you to customize how the date and time are displayed when using the date command.

The following table shows the most common format specifiers, their descriptions, and examples of using them:

FormatDescriptionExample
%Y Full year (4 digits). date +"%Y" outputs 2024.
%m Month (01-12). date +"%m" outputs 10.
%d Day of the month (01-31). date +"%d" outputs 08.
%H Hour (00-23, 24-hour format). date +"%H" outputs 14.
%M Minute (00-59). date +"%M" outputs 45.
%S Second (00-59). date +"%S" outputs 30.
%A Full weekday name. date +"%A" outputs Tuesday.
%a Abbreviated weekday name. date +"%a" outputs Tue.
%B Full month name. date +"%B" outputs October.
%b Abbreviated month name. date +"%b" outputs Oct.
%p AM or PM indicator (12-hour format). date +"%I %p" outputs 02 PM.
%I Hour (01-12, 12-hour format). date +"%I" outputs 02.
%T Time in 24-hour format (HH:MM). date +"%T" outputs 14:45:30.
%D Date in MM/DD/YY format. date +"%D" outputs 10/08/24.


© 2009-2018 Chris Petermann | Fueled by CodeIgniter | generated in 0.0111s