In the first form, print the current date and time,
specifying an optional display
In the second form, a privileged user can set the current date by supplying
format can consist of literal text strings (blanks must be quoted)
as well as field descriptors, whose values will appear as described below
(the listing shows some logical groupings).
Insert a newline.
Insert a tab.
Month of year (01-12).
Day of month (01-31).
Last two digits of year (00-99).
Date in %m/%d/%y format.
Abbreviated month name.
Day of month (1-31); pad single digits with a space.
Four-digit year (e.g., 1996).
Same as %b.
Full month name.
Hour in 24-hour format (00-23).
Second (00-61); 61 permits leap seconds.
Time in %H:%M format.
Time in %H:%M:%S format.
Hour in 12-hour format (01-12).
String to indicate a.m. or p.m. (default is AM or PM).
Time in %I:%M:%S %p format.
Day of week (Sunday = 0).
Week number in year (00-53); start week on Sunday.
Week number in year (00-53); start week on Monday.
Julian day of year (001-366).
Time zone name.
Country-specific date format.
Country-specific time format.
Country-specific date and time format (default is %a %b %e %T %Z %Y; e.g., Mon Feb 1 14:30:59 EST 1993).
The preceding country-specific formats, as well as language names (e.g., for month and weekday) are defined in a file given by strftime(4).
(Privileged user only.) Gradually adjust the system clock until
s seconds away from
what it thinks is the "current" time.
(This allows continuous micro-adjustment of the clock while the
system is running.)
f is the fraction of seconds by which time drifts.
By default, the clock speeds up; precede
s by a - to slow down.
Display or set the time using Greenwich Mean Time.
A privileged user can set the date by supplying a numeric
string consists of time, day, and year
concatenated in one of three ways:
time or [
Note: You don't type the brackets.
A two-digit hour and two-digit minute (
HH uses 24-hour format.
A two-digit month and two-digit day of month (
default is current day and month.
The year specified as either the full four digits or just the last two digits; default is current year.
Set the date to July 1 (0701), 4 a.m. (0400), 1995 (95):
date +"Hello%t Date is %D %n%t Time is %T"
produces a formatted date as follows:
Hello Date is 05/09/93 Time is 17:53:39