ftp.nice.ch/pub/next/unix/tools/date.README

This is the README for date.0.1.NIHS.bs.tar.gz [Download] [Browse] [Up]

This is the NetBSD version of unix "date" ported to compile and
execute under NeXTSTEP 3.3.  It also includes a quad-fat binary
for those who don't want to or can't compile the source.  The
NeXTSTEP version of "date" is of little value in scripts since it
doesn't support the "+" option.   This version does support the
"+" option, but unfortunately does so using the NeXTSTEP "strftime()"
library call rather than the NetBSD system call.  The NeXTSTEP
"strftime()" function is also limiting.   In fact, it's not even
possible to duplicate the output of the regular "date" command with
strftime which may explain why there's no "+" option.  However,
it's better than nothing.

I make no guarantees that this version of date works correctly.
It seems to work well enough for me, but I'm only using it to
generate formatted strings containing %y%m%d.

I've hacked in support for the correct output of date when given
no + option just to keep things compatible in case someone uses
this date function instead of the system-supplied one.   It looked
like it would be too much work to also port the NetBSD version of
strftime().

Along with all of the other problems that popped up when trying to
port this, I also was unable to generate a nicely formatted man
page.   I'm including an SGI man page for date (since it's all I
have access to) even though it's probably wrong in some areas.
It's still closer to what this version of date does than what the
NeXTSTEP man page outputs.   For the important stuff (what options
are available for use with "+"), see the strftime (3) man page.

If anyone feels like improving this port, please do so.  Including
a better version of strftime would be great.   Creating a man page
from the date.1 source file would also be great.  Please send me
any updates you make so I can start using them :)  It's unlikely
that I'll spend any further time improving this port.

This file was originally uploaded to
ftp://next-ftp.peak.org/pub/next/submissions/date-unix-0.1-NIHS.bs.tar.gz.
I would expect to see it eventually migrate to
ftp://next-ftp.peak.org/pub/next/sources/util/date-unix-0.1-NIHS.bs.tar.gz

-Mike Kienenberger
 mkienenb@alaska.net
 June 23rd, 1996

date(1)                                                                date(1)

NAME
     date - print and set the date

SYNOPSIS
     date [ -u ] [ + format ]
     date [ -a [ - ] sss.fff ]
     date [ -u | -n ] [[ mmdd]HHMM | mmddHHMM[cc]yy ] [ .ss ]

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 if the
     user is super-user.

     Supplementary code set characters in +format (see below) are recognized
     and displayed according to the locale specified in the LC_CTYPE
     environment variable [see LANG on environ(5)].  Month and weekday names
     are recognized according to the locale specified in the LC_TIME
     environment variable, as described below.

     -a [ - ] sss.fff
                 Slowly adjust the time by sss.fff seconds (fff represents
                 fractions of a second).  This adjustment can be positive or
                 negative.  The system's clock will be sped up or slowed down
                 until it has drifted by the number of seconds specified.

     -u          Display (or set) the date in Greenwich Mean Time (GMT-
                 universal time), bypassing the normal conversion to (or from)
                 local time.

     mm          is the month number

     dd          is the day number in the month

     HH          is the hour number (24 hour system)

     MM          is the minute number

     ss          is the second(s) number

     cc          is the century minus one

     yy          is the last 2 digits of the year number

                 The month, day, year, and century may be omitted; the current
                 values are supplied as defaults.  For example:

                       date 10080045

                 sets the date to Oct 8, 12:45 AM.  The current year is the
                 default because no year is supplied.  The system operates in
                 GMT.  date takes care of the conversion to and from local
                 standard and daylight time.  Only super-user may change the
                 date.  After successfully setting the date and time, date
                 displays the new date according to the default format.  The
                 date command uses TZ to determine the correct time zone
                 information [see environ(5)].

     + format    If the argument begins with +, the output of date is under
                 the control of the user.  Each Field Descriptor, described
                 below, is preceded by % and is 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).  Supplementary code set characters may
                 be used in format.

     As noted, month and weekday names are recognized according to the locale
     specified in the LC_TIME environment variable [see LANG on environ(5)].
     The names are taken from a file whose format is specified in strftime(4).
     This file also defines country-specific date and time formats such as %c,
     which specifies the default date format.  The following form is the
     default for %c:

               %a %b %e %T %Z %Y
               e.g., Fri Dec 23 10:10:42 EST 1988

     Field Descriptors (must be preceded by a %):
         a   abbreviated weekday name
         A   full weekday name
         b   abbreviated month name
         B   full month name
         c   country-specific date and time format
         d   day of month - 01 to 31
         D   date as %m/%d/%y
         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 new-line character
         p   string containing ante-meridiem or post-meridiem indicator (by
             default, AM or PM)
         r   time as %I:%M:%S %p
         R   time as %H:%M
         S   second - 00 to 61, allows for leap seconds
         t   insert a tab character
         T   time as %H:%M:%S
         U   week number of year (Sunday as the first day of the week) - 00 to
             53
         w   day of week - Sunday = 0
         W   week number of year (Monday as the first day of the week) - 00 to
             53
         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

EXAMPLE
     The command

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

     generates as output:

          DATE: 08/01/76
          TIME: 14:45:05

FILES
     /usr/lib/locale/locale/LC_MESSAGES/uxcore.abi
          language-specific message file [See LANG on environ (5).]

SEE ALSO
     syslog(3), strftime(4), timed(1M), timeslave(1M), utmp(4), environ(5)

DIAGNOSTICS
     UX:date:ERROR:No permission
                       You are not super-user and you try to change the date.
     UX:date:ERROR:bad conversion
                       The date set is syntactically incorrect.

NOTES
     If you attempt to set the current date to one of the dates on which the
     standard and alternate time zones change (for example, the date that
     daylight 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.

     If you are running a network-based time service, such as timed, then it
     will override any changes you make with the date command.

                                                                        Page 3

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.