1date(1)                          User Commands                         date(1)
2
3
4

NAME

6       date - write the date and time
7

SYNOPSIS

9       /usr/bin/date [-u] [+format]
10
11
12       /usr/bin/date [-a [-]sss.fff]
13
14
15       /usr/bin/date [-u] [ [mmdd] HHMM | mmddHHMM [cc] yy] [.SS]
16
17
18       /usr/xpg4/bin/date [-u] [+format]
19
20
21       /usr/xpg4/bin/date [-a [-]sss.fff]
22
23
24       /usr/xpg4/bin/date [-u]
25            [ [mmdd] HHMM | mmddHHMM [cc] yy] [.SS]
26
27

DESCRIPTION

29       The  date  utility  writes  the  date  and  time  to standard output or
30       attempts to set the system date and time. By default, the current  date
31       and time is written.
32
33
34       Specifications  of  native  language  translations of month and weekday
35       names are supported. The month and weekday names used  for  a  language
36       are  based on the locale specified by the environment variable LC_TIME.
37       See environ(5).
38
39
40       The following is the default form for the "C" locale:
41
42         %a %b %e %T %Z %Y
43
44
45
46       For example,
47
48         Fri Dec 23 10:10:42 EST 1988
49
50
51

OPTIONS

53       The following options are supported:
54
55       -a [-]sss.fff           Slowly adjust the time by sss.fff seconds  (fff
56                               represents fractions of a second). This adjust‐
57                               ment can be positive or negative. The  system's
58                               clock  is  sped  up or slowed down until it has
59                               drifted by the  number  of  seconds  specified.
60                               Only the super-user may adjust the time.
61
62
63       -u                      Display  (or  set)  the  date in Greenwich Mean
64                               Time (GMT—universal time), bypassing the normal
65                               conversion to (or from) local time.
66
67

OPERANDS

69       The following operands are supported:
70
71       +format     If  the  argument  begins with +, the output of date is the
72                   result of passing format and  the  current  time  to  strf‐
73                   time().  date  uses the conversion specifications listed on
74                   the strftime(3C) manual page, with the conversion  specifi‐
75                   cation  for  %C  determined  by  whether  /usr/bin/date  or
76                   /usr/xpg4/bin/date is used:
77
78                   /usr/bin/date          Locale's date and  time  representa‐
79                                          tion. This is the default output for
80                                          date.
81
82
83                   /usr/xpg4/bin/date     Century (a year divided by  100  and
84                                          truncated  to an integer) as a deci‐
85                                          mal number [00-99].
86
87                   The string is always terminated with a NEWLINE. An argument
88                   containing blanks must be quoted; see the EXAMPLES section.
89
90
91       mm          Month number
92
93
94       dd          Day number in the month
95
96
97       HH          Hour number (24 hour system)
98
99
100       MM          Minute number
101
102
103       SS          Second number
104
105
106       cc          Century (a year divided by 100 and truncated to an integer)
107                   as a decimal number [00-99]. For example, cc is 19 for  the
108                   year 1988 and 20 for the year 2007.
109
110
111       yy          Last  two digits of the year number. If century (cc) is not
112                   specified, then values in the range 69-99  shall  refer  to
113                   years 1969 to 1999 inclusive, and values in the range 00-68
114                   shall refer to years 2000 to 2068, inclusive.
115
116
117
118       The month, day, year number, and century may be  omitted;  the  current
119       values are applied as defaults. For example, the following entry:
120
121         example% date 10080045
122
123
124
125
126       sets  the  date  to  Oct  8, 12:45 a.m. The current year is the default
127       because no year is supplied. The system operates  in  GMT.  date  takes
128       care  of  the  conversion to and from local standard and daylight time.
129       Only the super-user may change the date. After successfully setting the
130       date and time, date displays the new date according to the default for‐
131       mat. The date command uses TZ to determine the correct time zone infor‐
132       mation; see environ(5).
133

EXAMPLES

135       Example 1 Generating Output
136
137
138       The following command:
139
140
141         example% date '+DATE: %m/%d/%y%nTIME:%H:%M:%S'
142
143
144
145
146       generates as output
147
148
149         DATE: 08/01/76
150
151         TIME: 14:45:05
152
153
154
155       Example 2 Setting the Current Time
156
157
158       The following command sets the current time to 12:34:56:
159
160
161         example# date 1234.56
162
163
164
165       Example 3 Setting Another Time and Date in Greenwich Mean Time
166
167
168       The following command sets the date to January 1st, 12:30 am, 2000:
169
170
171         example# date -u 010100302000
172
173
174
175
176       This is displayed as:
177
178
179         Thu Jan 01 00:30:00 GMT 2000
180
181
182

ENVIRONMENT VARIABLES

184       See  environ(5) for descriptions of the following environment variables
185       that affect the execution of date:  LANG,  LC_ALL,  LC_CTYPE,  LC_TIME,
186       LC_MESSAGES, and NLSPATH.
187
188       TZ     Determine  the  timezone in which the time and date are written,
189              unless the -u option is specified. If the TZ variable is not set
190              and  the  -u  is  not  specified, the system default timezone is
191              used.
192
193

EXIT STATUS

195       The following exit values are returned:
196
197       0      Successful completion.
198
199
200       >0     An error occurred.
201
202

ATTRIBUTES

204       See attributes(5) for descriptions of the following attributes:
205
206   /usr/bin/date
207       ┌─────────────────────────────┬─────────────────────────────┐
208       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
209       ├─────────────────────────────┼─────────────────────────────┤
210       │Availability                 │SUNWcsu                      │
211       ├─────────────────────────────┼─────────────────────────────┤
212       │CSI                          │enabled                      │
213       └─────────────────────────────┴─────────────────────────────┘
214
215   /usr/xpg4/bin/date
216       ┌─────────────────────────────┬─────────────────────────────┐
217       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
218       ├─────────────────────────────┼─────────────────────────────┤
219       │Availability                 │SUNWxcu4                     │
220       ├─────────────────────────────┼─────────────────────────────┤
221       │CSI                          │enabled                      │
222       ├─────────────────────────────┼─────────────────────────────┤
223       │Interface Stability          │Standard                     │
224       └─────────────────────────────┴─────────────────────────────┘
225

SEE ALSO

227       strftime(3C), attributes(5), environ(5), standards(5)
228

DIAGNOSTICS

230       no permission      You are not the super-user and you tried  to  change
231                          the date.
232
233
234       bad conversion     The date set is syntactically incorrect.
235
236

NOTES

238       If  you  attempt  to  set the current date to one of the dates that the
239       standard and alternate time zones change (for example,  the  date  that
240       daylight  time  is starting or ending), and you attempt to set the time
241       to a time in the interval between the end  of  standard  time  and  the
242       beginning  of  the alternate time (or the end of the alternate time and
243       the beginning of standard time), the results are unpredictable.
244
245
246       Using the date command from within windowing environments to change the
247       date  can  lead  to unpredictable results and is unsafe. It can also be
248       unsafe in the multi-user mode, that is, outside of a windowing  system,
249       if  the  date is changed rapidly back and forth. The recommended method
250       of changing the date is 'date -a'.
251
252
253       Setting the system time or allowing the system time to progress  beyond
254       03:14:07 UTC Jan 19, 2038 is not supported on Solaris.
255
256
257
258SunOS 5.11                        11 May 2004                          date(1)
Impressum