Date


$ date Sun Sep 3 16:00:03 MDT 2017

The date command returns the date which is a novel concept. It also returns the time in just about any way you would like it. Each system has a default format but the date command is very versitile. The date command goes like this:


However, that can be broken down into many different versions. This page documents the date formats available with date.

CREATED 2017-09-03 15:58:46.0

00-2A-89

UPDATED 2017-09-03 15:58:46.0

Options


-d --date=string Display a date relative to the current date as described by string. Yesterday, tommorrow, x days ago, are a few examples.
-f --f=datefile read the date formats from a file to produce a date for each line $ cat dateFile.txt 1 day ago 10 minutes ago 5 hours ago tomorrow yesterday
$ date -f dateFile.txt Sat Sep 2 17:09:06 MDT 2017 Sun Sep 3 16:59:06 MDT 2017 Sun Sep 3 12:09:06 MDT 2017 Mon Sep 4 17:09:06 MDT 2017 Sat Sep 2 17:09:06 MDT 2017












-ITIMESPEC --iso-8601[=TIMESPEC] Output date/time in ISO 8601 format
-r --reference=FILE output the last time FILE was modified
-R --rfc-822 Prints date string iaw RFC 822
-s --set=STRING Set the time described by string.
-u --utc-universal Print or set universal coordinated time
-h --help Displays... ahhh... help?
-v --version Pretty sure it displays the version of the date software.

CREATED 2017-09-03 16:09:10.0

00-2A-8B

UPDATED 2017-09-03 16:09:14.0

Format


Date Description
D Date in mm/dd/yy format
x Date in standard format
Year Description
C Century - the first two digits of a four digit year
Y or G 4 digit year e.g. 2017
y or g 2 digit year e.g. 17
Month Description
b or h Month abbr name
B Month full name
m Month number
Week Description
W or U Week number. Number of the week in the year
V Week number of the year when the begining week has more than 4 days.
Day
a Week day name abbr
A Weed day full name
u or w Number of the day of the week (sun..sat) (0..6)
d Day number of the month
e Day number of the month with no preceeding zero
j Day of the year (julian date)
Time Description
p AM or PM
r 12 hour time
R 24 hour time
T or X 24 hour time with seconds
Z Time zone or offset
Hour Description
H or k Hour (0-23)
I or l Hour (1-12)
Minutes Description
M Minute of the hour (0-59)
Seconds Description
S Seconds of the minute (0-59)
s Seconds since the epoch

Date pads all numeric fields with zeros. To prevent this there are two options.

  • - Hyphen which removes any preceeding zeros and
  • _ Underscore which pads the output with spaces.

CREATED 2017-09-03 16:04:11.0

00-2A-8A

UPDATED 2017-09-06 18:03:01.0

Knowledge

L
I
N
K
S

DBID: db.wam

Page Server: Ruger

©2012 Leistware Data Systems

      Hello anonymous