2014-03-02 21:25:49 +00:00
|
|
|
# date
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
> Set or display the system date.
|
2021-04-01 16:54:26 +01:00
|
|
|
> More information: <https://www.gnu.org/software/coreutils/date>.
|
2014-03-02 21:25:49 +00:00
|
|
|
|
2016-10-06 12:05:12 +01:00
|
|
|
- Display the current date using the default locale's format:
|
2014-03-02 21:25:49 +00:00
|
|
|
|
2022-10-23 17:19:15 +01:00
|
|
|
`date +%c`
|
2014-03-02 21:25:49 +00:00
|
|
|
|
2022-10-23 17:19:15 +01:00
|
|
|
- Display the current date in UTC, using the ISO 8601 format:
|
2014-03-02 21:25:49 +00:00
|
|
|
|
2022-10-26 03:36:33 +01:00
|
|
|
`date -u +%Y-%m-%dT%H:%M:%S%Z`
|
2016-09-08 04:46:34 +01:00
|
|
|
|
2016-10-06 12:05:12 +01:00
|
|
|
- Display the current date as a Unix timestamp (seconds since the Unix epoch):
|
2016-09-08 04:46:34 +01:00
|
|
|
|
|
|
|
`date +%s`
|
|
|
|
|
2022-10-23 17:19:15 +01:00
|
|
|
- Convert a date specified as a Unix timestamp to the default format:
|
2016-09-08 04:46:34 +01:00
|
|
|
|
2022-10-23 17:19:15 +01:00
|
|
|
`date -d @{{1473305798}}`
|
2019-01-11 10:12:29 +00:00
|
|
|
|
2022-10-23 17:19:15 +01:00
|
|
|
- Convert a given date to the Unix timestamp format:
|
2019-01-11 10:12:29 +00:00
|
|
|
|
|
|
|
`date -d "{{2018-09-01 00:00}}" +%s --utc`
|
2020-03-28 01:47:55 +00:00
|
|
|
|
|
|
|
- Display the current date using the RFC-3339 format (`YYYY-MM-DD hh:mm:ss TZ`):
|
|
|
|
|
|
|
|
`date --rfc-3339=s`
|
2021-11-26 21:15:53 +00:00
|
|
|
|
|
|
|
- Set the current date using the format `MMDDhhmmYYYY.ss` (`YYYY` and `.ss` are optional):
|
|
|
|
|
|
|
|
`date {{093023592021.59}}`
|
2022-10-23 17:19:15 +01:00
|
|
|
|
|
|
|
- Display the current ISO week number:
|
|
|
|
|
|
|
|
`date +%V`
|