Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ tdate(1) — Interactive 3.2r4.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cftime(4)

environ(5)

tdate(1)  —  

NAME

tdate − print and set the date

SYNOPSIS

date [ + format ]
date [ mmddhhmm [ [ yy ]  [ ccyy ] ] ]

DESCRIPTION

If no argument is given, or if the argument begins with +, the current date and time are printed.  Otherwise, the current date is set (only by the superuser).  The first mm is the month number; dd is the day number in the month; hh is the hour number (24-hour system); the second mm is the minute number; cc is the century minus one and is optional; yy is the last two digits of the year number and is optional.  For example:

date 10080045

sets the date to October 8, 12:45 a.m.  The current year is the default if no year is mentioned.  The system operates in Universal Coordinated Time (UTC).  tdate(1) takes care of the conversion to and from local standard and daylight saving time. Only the superuser may change the date.

If the argument begins with +, the output of tdate is under the control of the user.  All output fields are of fixed size (zero-padded if necessary).  Each field descriptor is preceded by % and will be replaced in the output by its corresponding value.  A single % is encoded by %%.  All other characters are copied to the output without change.  The string is always terminated with a new-line character.  If the argument contains embedded blanks, it must be quoted (see the EXAMPLE ­section). 

Specifications of native language translations of month and weekday names are supported.  The language used depends on the value of the environment variable LANGUAGE (see environ(5)). The month and weekday names used for a language are taken from strings in the file for that language in the /lib/cftime directory (see cftime(4)).

After successfully setting the date and time, tdate will display the new date according to the format defined in the environment variable CFTIME (see environ(5)).

Field Descriptors (must be preceded by a %):

a abbreviated weekday name

A full weekday name

b abbreviated month name

B full month name

d day of month − 01 to 31

D date as mm/dd/yy

e day of month − 1 to 31 (single digits are preceded by a blank)

h abbreviated month name (alias for %b)

H hour − 00 to 23

I hour − 01 to 12

j day of year − 001 to 366

m month of year − 01 to 12

M minute − 00 to 59

n insert a newline character

p string containing ante-meridiem or post-meridiem indicator (by default, a.m. or p.m.) 

r time as hh:mm:ss pp where pp is the ante-meridiem or post-meridiem indicator (by default, a.m. or p.m.) 

R time as hh:mm

S second − 00 to 59

t insert a tab character

T time as hh:mm:ss

U week number of year (Sunday as the first day of the week) − 01 to 52

w day of week − Sunday = 0

W week number of year (Monday as the first day of the week) − 01 to 52

x country-specific date format

X country-specific time format

y year within century − 00 to 99

Y year as ccyy (4 digits)

Z timezone name

If timed(1) is running to synchronize the clocks of machines in a local area network, tdate sets the time globally on all those machines. 

EXAMPLE

date ’+DATE: %m/%d/%y%nTIME: %H;%M:%S’

would have generated as output:

DATE: 08/01/76
.Pministrators should note the following: if you attempt to set the           s-1TIME: 14:45:05 .RE

Note

Administrators should note the following: if you attempt to set the current date to one of the dates that the standard and alternate time zones change (for example, the date that daylight savings time is starting or ending), and you attempt to set the time to a time in the interval between the end of standard time and the beginning of the alternate time (or the end of the alternate time and the beginning of standard time), the results are unpredictable. 

FILES

/dev/kmem

SEE ALSO

cftime(4), environ(5) in the INTER­ACTIVE SDS Guide and Programmer’s Reference Manual. 

DIAGNOSTICS

No permission if you are not the superuser and you try to change the date

bad conversion if the date set is syntactically incorrect

bad format character if the field descriptor is not recognizable

\*U  —  Version 1.0

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026