Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ date(C) — OpenDesktop 3.0.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought


 date(C)                         19 June 1992                         date(C)


 Name

    date - print and set the date

 Syntax

    date [ mmddhhmm[yy] ] [ +format ]

 Description

    If no argument is given, or if the argument begins with +, the current
    date and time are printed as defined by the locale.  Otherwise, the
    current date is set.  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; yy is the last 2 digits of the year number and
    is optional.  For example:

       date 10080045

    sets the date to Oct 8, 12:45 AM, if the local language is set to
    English.  The current year is the default if no year is mentioned.  The
    system operates in GMT.  date takes care of the conversion to and from
    local standard and daylight time.

    If the argument begins with +, the output of date is under the control of
    the user.  The format for the output is similar to that of the first
    argument to printf(S).  All output fields are of fixed size (zero padded
    if necessary).  Each field descriptor is preceded by a percent sign ``%''
    and will be replaced in the output by its corresponding value.  A single
    percent sign is encoded by doubling the percent sign, that is, by speci-
    fying ``%%''.  All other characters are copied to the output without
    change.  The string is always terminated with a new line character.

    Field Descriptors:

    A   Full weekday name

    B   Full month name

    D   Date as mm/dd/yy

    H   Hour - 00 to 23

    I   Hour (12 hour clock) in the range 01 - 12

    M   Minute - 00 to 59

    S   Second - 00 to 59

    T   Time as HH:MM:SS

    U   Week number of the year (Sunday as the first day of the week) as a
        decimal number in the range 00 - 53

    W   Week number of the year (Monday as the first day of the week) as a
        decimal number in the range 00 - 53

    X   Current time, as defined by the locale

    Y   Year (including century), as decimal numbers

    Z   Timezone name, or no characters if no timezone exists

    a   Abbreviated weekday - Sun to Sat

    b   Abbreviated month name

    c   current date and time, as defined by the locale

    d   Day of month - 01 to 31

    h   Abbreviated month - Jan to Dec

    j   Day of the year - 001 to 366

    m   Month of year - 01 to 12

    n   Inserts a newline character

    p   Equivalent of a.m. or p.m. for current locale

    r   Time in AM/PM notation

    t   Inserts a tab character

    w   Day of the week - Sunday = 0

    x   Current date, as defined by the locale

    y   Last 2 digits of year - 00 to 99

 Example

    The line

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

    generates as output:

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


 Diagnostics


    no permission          You are not the super user and you are trying to
                           change the date.


    bad conversion         The date set is syntactically incorrect.

 Standards conformance

    date is conformant with:

    AT&T SVID Issue 2;
    and X/Open Portability Guide, Issue 3, 1989.


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