Module 30 date

Previous Table of Contents Next


Module 30
date

DESCRIPTION

The date command displays the date and time. The super-user (system administrator) can use the date command to change the system s date and time. Any user can use the date command to display the date and time in a standard default format or in a formatted output.

COMMAND FORMAT

Following is the general format of the date command.

 date [ -a[-]sss.fff ] [ -u ][mmdd]hhmm      date [ -a[-]sss.fff ] [ -u ][ mmddhhmmcc[yy] ]      date [ -u ] [ +format ] 

BSD (Berkeley)
date [ -n ] [ -u ] [ yymmddhhmm.ss] ]
Some BSD systems support the format function of the date command. Check your system s User Reference Manual.

Options

The following list describes the options that may be used to control how date functions.

-a[-] sss.fff Adjust the time by plus or minus ([-]) sss seconds and fff fractions of a second. The systems clock will speed up or slow down until it has slowly adjusted by the specified time of sss.fff . This option is not supported on all systems.
-u Display the date in GMT (Universal time). The system s actual time is set in GMT. The date command performs the necessary conversion to display the date in your current time zone, based on the TZ environment variable. The -u option can also be used to set the time in GMT.
mmddhhmm[cc]yy Change the date and time to the new date and time specified. The century (cc) is not required. The first mm specifies the month, dd the day, hh the hour (24- hour base), the second mm the minutes, and yy specifies the year.
+format Special format strings used to retrieve the date and time in formatted output. See the following format descriptors.

BSD (Berkeley)
yymmddhhmm[.ss] Change the date and time to the new date and time specified. The yy specifies the year, the first mm the month, dd the day, hh the hour (24- hour base), and the second mm the minutes. If you include the .ss then the seconds are set appropriately.
-n If timed, the network time daemon, is running, date sets the time globally on all systems on the local network unless you specify the -n option. The timed command synchronizes the clocks of machines in a local area network.

Format Descriptors

The following is a list of format descriptors. Each descriptor must be preceded by a % character. To display a % character enter %%.

Date format descriptors:

%A The full weekday (Sunday-Saturday)
%a The abbreviated weekday (Sun - Sat)
%B The full month name (January-December)
%b The same as %h
%c The country specific date and time format
%D The date (mm/dd/yy)
%d The day of the month (01 - 31)
%e The day of the month ( 1-31; single digits are preceded by blanks)
%h The abbreviated month (Jan - Dec)
%j The julian date, day of the year (001 to 365)
%m The month of the year (01 - 12)
%U The week number of year (00-53; Sunday is first day of week)
%W The week number of year (00-53; Monday is first day of week)
%w The day of the week (0=Sunday - 6=Saturday)
%X The country specific date format
%Y The year in century format(1990)
%y The current year (00 - 99)

Time format descriptors:

%H The hours (00 - 24)
%I The hours (00 - 12)
%M The minutes (00 - 59)
%p The string containing ante or post meridian indicator (defaults are AM or PM)
%r The time (HH:MM:SS AM/PM)
%S The seconds (00 - 59)
%T The time (HH:MM:SS)
%x The country specific time format
%Z Timezone name

Output format characters :

%n Display a new-line
%t Display a tab
%% Display a percent sign (%)

BSD (Berkeley)
Most BSD systems do not support any format descriptors.

DIAGNOSTICS & BUGS

The following list describes possible error messages you may receive from date .

no permissions You tried to change the date and you are not the super-user.
bad conversion Syntax error in new date or time specification
bad format character Syntax error in the format string


Previous Table of Contents Next

Copyright Wordware Publishing, Inc.


Illustrated UNIX System V
Illustrated Unix System V/Bsd
ISBN: 1556221878
EAN: 2147483647
Year: N/A
Pages: 144
Authors: Robert Felps

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net