Visit Our UNIX and Linux User Community

Linux and UNIX Man Pages

Test Your Knowledge in Computers #354
Difficulty: Medium
gawk is the only awk implementation that makes serious progress implementing internationalization and localization and TCP/IP networking.
True or False?
Linux & Unix Commands - Search Man Pages

date(1) [hpux man page]

date(1) 						      General Commands Manual							   date(1)

NAME
date - display or set the date and time SYNOPSIS
[mmddhhmm[[cc]yy]] sssfff]] DESCRIPTION
The command displays or sets the current HP-UX system clock date and time. Since the HP-UX system operates in Coordinated Universal Time (UTC), automatically converts to and from local standard or daylight/summer time, based on your environment variable. See in below. Options recognizes the following option: Input and output values in Coordinated Universal Time (UTC), functionally equivalent to Greenwich Mean Time (GMT), instead of in local time. Slowly adjust the time by 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. Formats The command has two forms for displaying the date and time and one form for setting them. Display the current date and time. The output is the same as for the formatting directive for all languages except the default language. See and below. Display the current date and time according to formatting directives specified in format, which is a string of zero or more formatting directives and ordinary characters. If it contains blanks, enclose it in apostrophes or quotation marks. See below. All ordinary characters are copied unchanged into the output string. The output string is always terminated with a newline character. If is specified and format is omitted, only a newline is output. Set the HP-UX system clock to the date and time specified. You require the superuser privilege. If you include the option, the specified date and time is assumed to be in Coordinated Universal Time (UTC). The numeric argument is interpreted left to right in two-digit pairs as follows: mm Month number dd Day number in the month hh Hour number (24-hour system) mm Minute number cc Century minus one yy Last two digits of the year number If omitted, the current year is used. If you attempt to set the date backwards, generates the warning, Type or the equivalent for your locale to set the clock backwards; anything else to cancel the command. When is used to set the date, a pair of date change records is written to the file (UNIX Standard only, see standards(5).) No warning is generated if date is set backwards. Formatting Directives The following formatting directives, shown without the optional field width and precision specification, are replaced by the indicated characters. If a directive is not one of the following, the result is undefined. The output for digits, characters, and words depends on the language/locale settings. See in below. The examples assume that the command was executed on Wednesday, January 12, 1994 at 7:45:58 p.m. Pacific Standard Time, using the default language. Abbreviated weekday name. For example, Full weekday name. For example, Abbreviated month name. For example, Full month name. For example, Current date and time representation. For example, Century (the year divided by 100 and truncated to an integer) as a two-digit decimal number For example, Day of the month as a two-digit decimal number For example, Day of the month as a two-character decimal number with leading space fill [ ]. For example, Combined Emperor/Era name and year. Hour (24-hour clock) as a two-digit decimal number For example, Hour (12-hour clock) as a two-digit decimal number For example, Day of the year as a three-digit decimal number For example, Month as a decimal two-digit number For example, Minute as a decimal two-digit number For example, Newline character. Emperor/Era name. Emperor/Era year. Equivalent of either AM or PM. For example, Time as %H:%M Second as a two-digit decimal number (allows for possible leap seconds) For example, Tab character. Weekday as a one-digit decimal number For example, Week number of the year (Sunday as the first day of the week) as a two-digit decimal number All days that precede the first Sunday in the year are considered to be in week For example, Week number of the year (Monday as the first day of the week) as a two-digit decimal number If the week containing January 1 has four or more days in the new year (January 1 is Thursday or sooner), it is designated as week otherwise, (January 1 is Friday or later), it is designated as the last week of the previous year, and the next week is week For example, Weekday as a one-digit decimal number For example, Week number of the year (Monday as the first day of the week) as a two-digit decimal number All days that precede the first Monday in the year are considered to be in week For example, Current date representation. For example, Current time representation. For example, Year without century as a two-digit decimal number For example, Year with century as a four-digit decimal number For example, Time zone name (or no characters if time zone cannot be determined). For example, The character. Obsolescent Directives The following directives are provided for backward compatibility. It is recommended that the preceding directives be used instead. Date in usual U.S. format. For example, Use or instead. Full month name. For example, Use instead. Abbreviated month name. For example, Use instead. Time in 12-hour U.S. format. For example, Use instead. Time in 24-hour U.S. format. For example, Use or instead. Time zone name (or no characters if time zone cannot be determined). For example, Use instead. Modified Formatting Directives Some Formatting Directives can be modified by the and modifier characters to indicate a different format or specification for the language specified in the environment variable. If the corresponding keyword and is not specified or not supported, the unmodified field descriptor value is used. The command displays the keywords and their values in the specified language (see locale(1)). Alternate appropriate date and time representation. The name of the base year in alternate representation. Alternate date representation. Offset from (year only) in the alternate representation. Full alternate year representation. Day of month using the alternate numeric symbols. Day of month using the alternate numeric symbols with leading space-character fill if applicable. Hour (24-hour clock) using the alternate numeric symbols. Hour (12-hour clock) using the alternate numeric symbols. Month using the alternate numeric symbols. Minutes using the alternate numeric symbols. Seconds using the alternate numeric symbols. Week number of the year (Sunday is the first day of the week) using the alternate numeric symbols. Weekday as number using the alternate numeric symbols Weekday number of the year (Monday is the first day of the week) using the alternate numeric symbols. Year (offset from in alternate representation. Field Width and Precision An optional field width and precision specification can immediately follow the initial of a formatting directive in the following order: The decimal digit string width specifies a minimum field width in which the result of the conversion is right- or left-justified. The default is right-justified with space padding on the left. If the string starts with "", the result is left-justified with space padding on the right. If the string starts with "", the result is right-justified and padded with zeros on the left. The decimal digit string prec specifies the minimum number of digits to appear for the and numeric directives. If a directive supplies fewer digits than specified by the precision, it will be expanded with leading zeros. prec specifies the maximum number of characters to be used from the and text directives. If a directive supplies more characters than specified by the precision, excess characters are truncated on the right. If no field width or precision is specified for a or directive, the default is for the directive, the default is for the default is for the default is EXTERNAL INFLUENCES
For information about the UNIX Standard environment, see standards(5). Environment Variables determines the interpretation of the bytes within the format string as single- and/or multi-byte characters. determines the characters used to form numbers for those directives that produce numbers in the output. The characters used are those defined by (see locale(1) and in langinfo(5)). determines the content (for example, the weekday names produced by the directive) and format (for example, the current time representation produced by the directive) of date and time strings output by the command. determines the language in which messages (other than the date and time strings) are displayed. If or is not specified or is null, it defaults to the value of If is not specified or is null, it defaults to (see lang(5)). If any internationalization variable contains an invalid setting, all internationalization variables default to (see environ(5)). determines the conversion between the system time in UTC and the time in the user's local time zone. See environ(5) and tztab(4). also determines the content (that is, the time-zone name produced by the and directives) of date and time strings output by the command. If is not set or is set to the empty string, its default value is If the or the value cannot be read from the time zone adjustment table then returns the time in International Code Set Support Single and multibyte character code sets are supported. DIAGNOSTICS
The following messages may be displayed. The date/time specification is syntactically incorrect. Check it against the usage and for the correct range of each of the digit-pairs. The character c is not a valid format directive, field width specifier, or precision specifier. The date/time you specified is earlier than the current clock value. Type (or the equivalent for your locale) to set the clock backwards; anything else to cancel the command. You need the superuser privilege to change the date. EXAMPLES
Date in Different Languages Display the date. In this example, the environment variable contains and the language environment variables are set as noted. Set Date Set the date to Oct 8, 12:45 a.m. Display Formatted Date Display the current date and time using a format. Note the use of quotation marks due to the blanks in the format. The output resembles the following: Display Formatted Date Using Local Language Conversion With the date as set in the "Set Date" example above and set to (German): generates output similar to: where the month field is four characters long, flush-left, and space-padded on the right if the month name is shorter than four characters. The day field is two characters long, with leading zeros suppressed. WARNINGS
The former HP-UX format directive has been changed to for ANSI compatibility. Changing the date while the system is running in multiuser mode should be avoided to prevent disrupting user-scheduled and time sensitive programs and processes. Also, changing the date can cause and the SCCS and subsystems to behave in an unexpected manner. The daemon should be killed prior to setting the date backwards, then restarted. SCCS files should be checked with the command (see val(1)) if deltas have been made while the clock was wrongly set. The following formatting directives may be deleted from future releases: Currently, the maximum date supported is December 31, 2037 23:59:00 UTC. AUTHOR
was developed by AT&T and HP. FILES
SEE ALSO
locale(1), stime(2), ctime(3C), strftime(3C), tztab(4), environ(5), lang(5), langinfo(5), standards(5). STANDARDS CONFORMANCE
date(1)

Featured Tech Videos