date utility is used to display current time and date.No user can modify the date and time unless they are the superuser i.e the system administrator.This is required for the smooth functioning of the system.
Syntax:
date[-u][+format]
date[-a[-]sss.fff][-u][[mmdd]HHMM | mmddHHMM[cc]yy]
If no argument is given, or if the argument begins with +, the current current date and time are printed.
-a[-]sss.fff Slowly adjusts the time by sss.fff seconds,where fff represents fractions of a
second.The adjustment can be positive or negative.The clock of the system will be
speeded up or slowed until it has drifted by the number of seconds specified.
-u Displays (or sets) the date in GMT(Greenwich Mean Time), bypassing the normal
conversion to or from normal or local time.
mm is the month
dd is the day of the month
HH is the hour in the 24 hr system.
MM is the minute
cc is the century minus one.
yy is the last two digits of the year .The month, day,year and century may be
omitted; the current values are applied as defaults.
For eg: date 12301600 sets the date to Dec 30, 4:00 PM. 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 the local standard and daylight saving time.
Only the superuser may change the date.After successfully setting the date and
time date displays the new date according to the default format. The date utility
uses the TZ in environ command to determine the correct time zone information.
+format If the argument begins with +, the output of the date is under the control of the
user. Each Field Descriptor, described in the next post,is preceeded 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 by a newline character.If the argument contains embedded
blanks ,it must be qouted.
No comments:
Post a Comment