DATE(1)

πŸ’– date(1) β€” the General Commands Manual glow-up πŸ’–

okay bestie, sit DOWN. we're talking about date(1) β€” the general commands manual's most underrated icon. she prints the system date and time, she sets the system date and time, she does format sequences like it's nothing. main character energy fr fr πŸŒˆπŸ‘‘


✨ NAME ✨

date β€” print or set the system date and time πŸ•°οΈπŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

date [OPTION]... [+FORMAT]...
date [OPTION]... [MMDDhhmm[[CC]YY][.ss]]

FORMAT controls the output, bestie. and the interpreted sequences are β€” get ready, this is the whole squad:

🌸 the format sequences (she's giving RANGE) 🌸

  • %% β€” a literal % β†’ e.g. %
  • %a β€” locale's abbreviated weekday name β†’ e.g. Sun
  • %A β€” locale's full weekday name β†’ e.g. Sunday
  • %b β€” locale's abbreviated month name β†’ e.g. Jan
  • %B β€” locale's full month name β†’ e.g. January
  • %c β€” locale's date and time β†’ e.g. Thu Mar 3 23:05:25 2005
  • %C β€” century; like %Y, except omit last two digits β†’ e.g. 20
  • %d β€” day of month β†’ e.g. 01
  • %D β€” date; same as %m/%d/%y β†’ e.g. 12/31/99
  • %e β€” day of month, space padded; same as %_d β†’ e.g. 3
  • %F β€” full date; same as %Y-%m-%d β†’ e.g. 2005-03-03
  • %g β€” last two digits of year of ISO week number (see %G) β†’ e.g. 05
  • %G β€” year of ISO week number (see %V); normally useful only with %V β†’ e.g. 2005
  • %h β€” same as %b β†’ e.g. Jan
  • %H β€” hour (00..23) β†’ e.g. 23
  • %I β€” hour (01..12) β†’ e.g. 11
  • %j β€” day of year (001..366) β†’ e.g. 062
  • %k β€” hour, space padded ( 0..23); same as %_H β†’ e.g. 3
  • %l β€” hour, space padded ( 1..12); same as %_I β†’ e.g. 9
  • %m β€” month (01..12) β†’ e.g. 03
  • %M β€” minute (00..59) β†’ e.g. 30
  • %n β€” a newline β†’ e.g. \n
  • %N β€” nanoseconds (000000000..999999999) β†’ e.g. 123456789
  • %p β€” locale's equivalent of either AM or PM; blank if not known β†’ e.g. PM
  • %P β€” like %p, but lower case β†’ e.g. pm
  • %q β€” quarter of year (1..4) β†’ e.g. 1
  • %r β€” locale's 12-hour clock time β†’ e.g. 11:11:04 PM
  • %R β€” 24-hour hour and minute; same as %H:%M β†’ e.g. 23:30
  • %s β€” seconds since 1970-01-01 00:00:00 UTC β†’ e.g. 1615432800
  • %S β€” second (00..60) β†’ e.g. 30
  • %t β€” a tab β†’ e.g. \t
  • %T β€” time; same as %H:%M:%S β†’ e.g. 23:30:30
  • %u β€” day of week (1..7); 1 is Monday β†’ e.g. 4
  • %U β€” week number of year, with Sunday as first day of week (00..53) β†’ e.g. 10
  • %V β€” ISO week number, with Monday as first day of week (01..53) β†’ e.g. 12
  • %w β€” day of week (0..6); 0 is Sunday β†’ e.g. 4
  • %W β€” week number of year, with Monday as first day of week (00..53) β†’ e.g. 11
  • %x β€” locale's date representation β†’ e.g. 03/03/2005
  • %X β€” locale's time representation β†’ e.g. 23:30:30
  • %y β€” last two digits of year (00..99) β†’ e.g. 05
  • %Y β€” year β†’ e.g. 2005
  • %z β€” +hhmm numeric time zone β†’ e.g. -0400
  • %:z β€” +hh:mm numeric time zone β†’ e.g. -04:00
  • %::z β€” +hh:mm:ss numeric time zone β†’ e.g. -04:00:00
  • %:::z β€” numeric time zone with : to necessary precision β†’ e.g. -04, +05:30
  • %Z β€” alphabetic time zone abbreviation β†’ e.g. EDT

πŸ’… the padding flags (yes she has OPTIONS, we love a customizable queen) πŸ’…

by default, date pads numeric fields with zeroes. but the following optional flags may follow '%':

  • - (hyphen) do not pad the field
  • _ (underscore) pad with spaces
  • 0 (zero) pad with zeros
  • ^ use upper case if possible
  • # use opposite case if possible

after any flags comes an optional field width, as a decimal number. then an optional modifier, which is either:

  • E to use the locale's alternate representations if available, or
  • O to use the locale's alternate numeric symbols if available.

πŸ¦‹ examples (yes these live in SYNOPSIS, don't question it) πŸ¦‹

convert seconds since the epoch (1970-01-01 UTC) to a date:

date --date='@2147483647'

show the time on the west coast of the US (use tzselect(1) to find TZ):

TZ='America/Los_Angeles' date

🌟 DESCRIPTION 🌟

print or set the system date and time. that's it, that's the whole vibe. πŸ‘‘πŸ•°οΈ


πŸ”₯ OPTIONS πŸ”₯

  • -d, --date <STRING> β€” display time described by STRING, not 'now' πŸ‘€
  • -f, --file <DATEFILE> β€” like --date; once for each line of DATEFILE πŸ“„
  • -I, --iso-8601 [<FMT>] β€” output date/time in ISO 8601 format. FMT='date' for date only (the default), 'hours', 'minutes', 'seconds', or 'ns' for date and time to the indicated precision. example: 2006-08-14T02:34:56-06:00

possible values:

  • date
  • hours
  • minutes
  • seconds
  • ns
  • --resolution β€” output the available resolution of timestamps. example: 0.000000001 πŸ”¬
  • -R, --rfc-email β€” output date and time in RFC 5322 format. example: Mon, 14 Aug 2006 02:34:56 -0600 πŸ“§
  • --rfc-3339 <FMT> β€” output date/time in RFC 3339 format. FMT='date', 'seconds', or 'ns' for date and time to the indicated precision. example: 2006-08-14 02:34:56-06:00

possible values:

  • date
  • seconds
  • ns
  • --debug β€” annotate the parsed date, and warn about questionable usage to stderr πŸ›
  • -r, --reference <FILE> β€” display the last modification time of FILE πŸ—‚οΈ
  • -s, --set <STRING> β€” set time described by STRING ⏰
  • -u, --universal β€” print or set Coordinated Universal Time (UTC) 🌍
  • -h, --help β€” Print help πŸ†˜
  • -V, --version β€” Print version 🏷️
  • [format]

πŸ’œ VERSION πŸ’œ

v(uutils coreutils) 0.12.0 β€” she's still growing, be nice 🫢


⭐ EXAMPLES ⭐

display the current date using the default locale's format:

date +%c

display the current date in UTC, using the ISO 8601 format:

date [-u|--utc] +%Y-%m-%dT%H:%M:%S%Z

display the current date as a Unix timestamp (seconds since the Unix epoch):

date +%s

convert a date specified as a Unix timestamp to the default format:

date [-d|--date] @1473305798

convert a given date to the Unix timestamp format:

date [-d|--date] "2018-09-01 00:00" +%s [-u|--utc]

display the current date using the RFC-3339 format (YYYY-MM-DD hh:mm:ss TZ) and specify its precision:

date --rfc-3339 date|seconds|ns

set the current date using the format MMDDhhmmYYYY.ss (YYYY and .ss are optional):

sudo date 093023592021.59

display the current ISO week number:

date +%V
the examples are provided by the tldr-pages project <https://tldr.sh> under the CC BY 4.0 License. please note that, as uutils is a work in progress, some examples might fail. 😭 it's not her fault, she's literally still under construction πŸ’€

okay that's the whole page, bestie!! this was date(1) from the General Commands Manual, page dated 2026-09-25, and it lives in the uutils coreutils world β€” version v(uutils coreutils) 0.12.0. time to go format something gorgeous. periodt. πŸ’–βœ¨πŸ¦‹πŸŽ€πŸ’…

πŸ“¦ where this page comes from