14616d0f9Sopenharmony_cidate(1) General Commands Manual date(1) 24616d0f9Sopenharmony_ci 34616d0f9Sopenharmony_ciNAME 44616d0f9Sopenharmony_ci date - show and set date and time 54616d0f9Sopenharmony_ci 64616d0f9Sopenharmony_ciSYNOPSIS 74616d0f9Sopenharmony_ci date [ -u ] [ -c ] [ -r seconds ] [ +format ] [ [yyyy]mmddhhmm[yy][.ss] 84616d0f9Sopenharmony_ci ] 94616d0f9Sopenharmony_ci 104616d0f9Sopenharmony_ciDESCRIPTION 114616d0f9Sopenharmony_ci The date command without arguments writes the date and time to the 124616d0f9Sopenharmony_ci standard output in the form 134616d0f9Sopenharmony_ci Wed Mar 8 14:54:40 EST 1989 144616d0f9Sopenharmony_ci with EST replaced by the local time zone's abbreviation (or by the 154616d0f9Sopenharmony_ci abbreviation for the time zone specified in the TZ environment variable 164616d0f9Sopenharmony_ci if set). The exact output format depends on the locale. 174616d0f9Sopenharmony_ci 184616d0f9Sopenharmony_ci If a command-line argument starts with a plus sign ("+"), the rest of 194616d0f9Sopenharmony_ci the argument is used as a format that controls what appears in the 204616d0f9Sopenharmony_ci output. In the format, when a percent sign ("%" appears, it and the 214616d0f9Sopenharmony_ci character after it are not output, but rather identify part of the date 224616d0f9Sopenharmony_ci or time to be output in a particular way (or identify a special 234616d0f9Sopenharmony_ci character to output): 244616d0f9Sopenharmony_ci 254616d0f9Sopenharmony_ci Sample output Explanation 264616d0f9Sopenharmony_ci %a Wed Abbreviated weekday name* 274616d0f9Sopenharmony_ci %A Wednesday Full weekday name* 284616d0f9Sopenharmony_ci %b Mar Abbreviated month name* 294616d0f9Sopenharmony_ci %B March Full month name* 304616d0f9Sopenharmony_ci %c Wed Mar 08 14:54:40 1989 Date and time* 314616d0f9Sopenharmony_ci %C 19 Century 324616d0f9Sopenharmony_ci %d 08 Day of month (always two digits) 334616d0f9Sopenharmony_ci %D 03/08/89 Month/day/year (eight characters) 344616d0f9Sopenharmony_ci %e 8 Day of month (leading zero blanked) 354616d0f9Sopenharmony_ci %h Mar Abbreviated month name* 364616d0f9Sopenharmony_ci %H 14 24-hour-clock hour (two digits) 374616d0f9Sopenharmony_ci %I 02 12-hour-clock hour (two digits) 384616d0f9Sopenharmony_ci %j 067 Julian day number (three digits) 394616d0f9Sopenharmony_ci %k 2 12-hour-clock hour (leading zero blanked) 404616d0f9Sopenharmony_ci %l 14 24-hour-clock hour (leading zero blanked) 414616d0f9Sopenharmony_ci %m 03 Month number (two digits) 424616d0f9Sopenharmony_ci %M 54 Minute (two digits) 434616d0f9Sopenharmony_ci %n \n newline character 444616d0f9Sopenharmony_ci %p PM AM/PM designation 454616d0f9Sopenharmony_ci %r 02:54:40 PM Hour:minute:second AM/PM designation 464616d0f9Sopenharmony_ci %R 14:54 Hour:minute 474616d0f9Sopenharmony_ci %S 40 Second (two digits) 484616d0f9Sopenharmony_ci %t \t tab character 494616d0f9Sopenharmony_ci %T 14:54:40 Hour:minute:second 504616d0f9Sopenharmony_ci %U 10 Sunday-based week number (two digits) 514616d0f9Sopenharmony_ci %w 3 Day number (one digit, Sunday is 0) 524616d0f9Sopenharmony_ci %W 10 Monday-based week number (two digits) 534616d0f9Sopenharmony_ci %x 03/08/89 Date* 544616d0f9Sopenharmony_ci %X 14:54:40 Time* 554616d0f9Sopenharmony_ci %y 89 Last two digits of year 564616d0f9Sopenharmony_ci %Y 1989 Year in full 574616d0f9Sopenharmony_ci %z -0500 Numeric time zone 584616d0f9Sopenharmony_ci %Z EST Time zone abbreviation 594616d0f9Sopenharmony_ci %+ Wed Mar 8 14:54:40 EST 1989 Default output format* 604616d0f9Sopenharmony_ci * The exact output depends on the locale. 614616d0f9Sopenharmony_ci 624616d0f9Sopenharmony_ci If a character other than one of those shown above appears after a 634616d0f9Sopenharmony_ci percent sign in the format, that following character is output. All 644616d0f9Sopenharmony_ci other characters in the format are copied unchanged to the output; a 654616d0f9Sopenharmony_ci newline character is always added at the end of the output. 664616d0f9Sopenharmony_ci 674616d0f9Sopenharmony_ci In Sunday-based week numbering, the first Sunday of the year begins 684616d0f9Sopenharmony_ci week 1; days preceding it are part of "week 0". In Monday-based week 694616d0f9Sopenharmony_ci numbering, the first Monday of the year begins week 1. 704616d0f9Sopenharmony_ci 714616d0f9Sopenharmony_ci To set the date, use a command line argument with one of the following 724616d0f9Sopenharmony_ci forms: 734616d0f9Sopenharmony_ci 1454 24-hour-clock hours (first two digits) and minutes 744616d0f9Sopenharmony_ci 081454 Month day (first two digits), hours, and minutes 754616d0f9Sopenharmony_ci 03081454 Month (two digits, January is 01), month day, hours, minutes 764616d0f9Sopenharmony_ci 8903081454 Year, month, month day, hours, minutes 774616d0f9Sopenharmony_ci 0308145489 Month, month day, hours, minutes, year 784616d0f9Sopenharmony_ci (on System V-compatible systems) 794616d0f9Sopenharmony_ci 030814541989 Month, month day, hours, minutes, four-digit year 804616d0f9Sopenharmony_ci 198903081454 Four-digit year, month, month day, hours, minutes 814616d0f9Sopenharmony_ci If the century, year, month, or month day is not given, the current 824616d0f9Sopenharmony_ci value is used. Any of the above forms may be followed by a period and 834616d0f9Sopenharmony_ci two digits that give the seconds part of the new time; if no seconds 844616d0f9Sopenharmony_ci are given, zero is assumed. 854616d0f9Sopenharmony_ci 864616d0f9Sopenharmony_ci These options are available: 874616d0f9Sopenharmony_ci 884616d0f9Sopenharmony_ci -u or -c 894616d0f9Sopenharmony_ci Use Universal Time when setting and showing the date and time. 904616d0f9Sopenharmony_ci 914616d0f9Sopenharmony_ci -r seconds 924616d0f9Sopenharmony_ci Output the date that corresponds to seconds past the epoch of 934616d0f9Sopenharmony_ci 1970-01-01 00:00:00 UTC, where seconds should be an integer, 944616d0f9Sopenharmony_ci either decimal, octal (leading 0), or hexadecimal (leading 0x), 954616d0f9Sopenharmony_ci preceded by an optional sign. 964616d0f9Sopenharmony_ci 974616d0f9Sopenharmony_ciFILES 984616d0f9Sopenharmony_ci /etc/localtime local timezone file 994616d0f9Sopenharmony_ci /usr/lib/locale/L/LC_TIME description of time locale L 1004616d0f9Sopenharmony_ci /usr/share/zoneinfo timezone directory 1014616d0f9Sopenharmony_ci /usr/share/zoneinfo/posixrules default DST rules (obsolete) 1024616d0f9Sopenharmony_ci /usr/share/zoneinfo/GMT for UTC leap seconds 1034616d0f9Sopenharmony_ci 1044616d0f9Sopenharmony_ci If /usr/share/zoneinfo/GMT is absent, UTC leap seconds are loaded from 1054616d0f9Sopenharmony_ci /usr/share/zoneinfo/GMT0 if present. 1064616d0f9Sopenharmony_ci 1074616d0f9Sopenharmony_ciTime Zone Database date(1) 108