date(1) MPE/iX Shell and Utilities date(1)
______________________________________________________________________
NAME
date -- set and display date and time
SYNOPSIS
date [-cu] [timespec]
date [-cu] [+format]
DESCRIPTION
Note: The MPE/iX implementation of this utility does not function
exactly as this man page describes. For details, see the MPE/iX
NOTES section at the end of this man page.
date either displays the operating system's idea of the current
date and time, or sets it to a new value. The following example
shows the default format of the date:
Wed Feb 26 14:01:43 EST 1986
Options
date accepts the following options:
-c sets or displays the date and time according to Greenwich
Mean Time (Coordinated Universal Time) using CUT as the time
zone name.
-u sets or displays the date and time according to Greenwich
Mean Time (Coordinated Universal Time) using GMT as the time
zone name.
Setting Date and Time
date also accepts an argument in one of two forms. If the argu-
ment does not begin with +, date assumes it is a timespec of the
form
[[[[cc]yy]mm]dd]hhmm[.ss]
where cc is the optional first 2 digits of the year, yy is the
optional last 2 digits of the year, mm is the optional number of
the month (01-12), dd is the optional day of the month, hh is the
hour in 24 hour format (required), mm is the minutes (required),
and ss is the optional seconds. date uses these values to set
the date and time.
Note: You must specify the hours and the minutes; other arguments
are optional.
Displaying Date and Time
If the argument to date begins with a + character, date uses for-
mat to display the date. date writes all characters in format,
1
date(1) MPE/iX Shell and Utilities date(1)
______________________________________________________________________
with the exception of the % and the character which immediately
follows it, directly to the standard output. After date exhausts
the format string, it outputs a newline character. The % charac-
ter introduces a special format field similar to the printf()
function in the C library (see Field Descriptors).
Field Descriptors
date recognizes the following field descriptors:
%A the full weekday name in the current locale (for example,
Sunday, in English).
%a the abbreviation for the weekday in the current locale (for
example, Sun, in English).
%B the full month name in the current locale (for example, Feb-
ruary, in English).
%b the abbreviation for the month name in the current locale
(for example, Feb, in English).
%C the first two digits of the year (00 to 99).
%c the appropriate representation of the date and time in the
current locale.
%D the date in the form mm/dd/yy.
%d the two-digit day of the month as a number (01 to 31).
%e the day of the month in a two-digit, right-justified, blank-
filled field ( 1 to 31).
%H the hour in the 24-hour clock representation (00 to 23).
%h the same as %b.
%I the hour in the 12-hour clock representation (01 to 12).
%j the numeric day of the year (001 to 366).
%M the minute (00 to 59).
%m the month number (01 to 12).
%n a newline character.
%p the equivalent of AM or PM in the current locale.
%r the 12-hour time in the current locale's equivalent of AM/PM
notation (11:53:29 AM in the POSIX locale).
%S the seconds (00 to 61). Note that there is an allowance for
2
date(1) MPE/iX Shell and Utilities date(1)
______________________________________________________________________
two leap seconds.
%T the 24-hour time (14:53:29).
%t a tab character.
%U the week number in the year, with Sunday being the first day
of the week (00 to 53). All days before the first Sunday of
the new year are in week 0.
%u the weekday number with Monday being 1 and Sunday being 7.
%V the week number in the year, with Monday being the first day
of the week (01 to 53). If the week containing January 1 has
four or more days in the new year, it is week 1 of the new
year; otherwise it is week 53 of the previous year.
%W the week number in the year, with Monday being the first day
of the week (00 to 53). All days before the first Monday of
the new year are in week 0.
%w the weekday number, with Sunday being 0 and Saturday being
6.
%X the appropriate time representation in the current locale.
%x the appropriate date representation in the current locale.
%Y the year.
%y the two-digit year (offset from %C).
%Z the time zone name (for example, EDT).
%% a percent-sign character.
The date command also supports the following modified field
descriptors to indicate a different format as specified by the
locale indicated by LC_TIME. If the current locale does not sup-
port a modified descriptor, date uses the unmodified field
descriptor value.
%EC the name of the base year (period) in the current locale's
alternate representation.
%Ec the current locale's alternate date and time representation.
%Ex the current locale's alternate date representation.
%EY the full alternate year representation.
%Ey the offset from %EC (year only) in the current locale's
alternate representation.
3
date(1) MPE/iX Shell and Utilities date(1)
______________________________________________________________________
%Od the day of month using the current locale's alternate
numeric symbols .
%Oe the day of month using the current locale's alternate
numeric symbols in a two-character, right-justified, blank-
filled field.
%OH the hour (24-hour clock) using the current locale's alter-
nate numeric symbols.
%OI the hour (12-hour clock) using the current locale's alter-
nate numeric symbols.
%OM the minutes using the current locale's alternate numeric
symbols.
%Om the month using the current locale's alternate numeric sym-
bols.
%OS the seconds using the current locale's alternate numeric
symbols.
%OU the week number of the year (with Sunday as the first day of
the week) using the current locale's alternate numeric sym-
bols.
%Ou the weekday number using the current locale's alternate
numeric symbols with Monday being 1 and Sunday being 7.
%OV the week number in the year using the current locale's
alternate numeric symbols, with Monday being the first day
of the week. If the week containing January 1 has four or
more days in the new year, it is week 1 of the new year;
otherwise it is week 53 of the previous year.
%OW the week number of the year (with Monday as the first day of
the week) using the current locale's alternate numeric sym-
bols.
%Ow the weekday as a number using the current locale's alternate
numeric symbols with Sunday being 0 and Saturday being 6.
%Oy the year (offset from %C) using the current locale's alter-
nate numeric symbols.
EXAMPLES
The command
date '+%a %b %e %T %Z %Y'
produces the date in the default format. For example,
Wed Feb 26 14:01:43 EST 1986
4
date(1) MPE/iX Shell and Utilities date(1)
______________________________________________________________________
ENVIRONMENT VARIABLES
date uses the following environment variable:
TZ gives the time zone for date to use when displaying the
times. This is ignored if you specify either the -c or the
-u option. For more information on this variable, see
timezone(3).
DIAGNOSTICS
Possible exit status values are:
0 Successful completion.
>0 An error occurred.
Messages
Message: bad date conversion in "string"
Cause: The date and/or time specified on the command line had
an invalid format (for example, the hour is greater
than 24).
Action: Check the DESCRIPTION section of this man page for
valid date formats.
Message: bad format or date output longer than number bytes
Cause: The format string supplied to date is invalid, or the
output is longer than number bytes where number is the
value of the configuration variable LINE_MAX (see also
getconf(1)).
Action: Confirm that the date format string on the command line
is valid. or modify your date format to produce a
shorter output string.
Message: no permission to set date
Cause: You do not have proper permissions for changing the
system date.
Action: If you need the system date changed, talk to your sys-
tem manager.
Message: Unknown option "-option"
Cause: You specified an option that is not valid for this com-
mand.
Action: Check the DESCRIPTIONS section for a list of valid
options.
PORTABILITY
POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems. The
-c option is an extension to the POSIX standard.
MPE/iX NOTES
The current MPE/iX implementation of date does not allow you to
5
date(1) MPE/iX Shell and Utilities date(1)
______________________________________________________________________
set the date and time.
For information on how the current MPE/iX implementation may
affect the operation of this utility, see Appendix A, MPE/iX
Implementation Considerations.
SEE ALSO
touch(1), timezone(3)
6