From 8136ac19301be22a68a91ef60a1bd867cca4cd6c Mon Sep 17 00:00:00 2001 From: Daniel Compton Date: Thu, 8 Sep 2016 15:46:34 +1200 Subject: [PATCH 1/3] Add unix epoch commands These differ between Linux and OS X so the pages needed to be split. --- pages/{common => linux}/date.md | 8 ++++++++ pages/osx/date.md | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) rename pages/{common => linux}/date.md (57%) create mode 100644 pages/osx/date.md diff --git a/pages/common/date.md b/pages/linux/date.md similarity index 57% rename from pages/common/date.md rename to pages/linux/date.md index a0fa47e79..dcba66c1e 100644 --- a/pages/common/date.md +++ b/pages/linux/date.md @@ -9,3 +9,11 @@ - Display the date in UTC and ISO 8601 format: `date -u +"%Y-%m-%dT%H:%M:%SZ"` + +- Display the number of seconds since the unix epoch: + +`date +%s` + +- Convert a unix epoch timestamp to a date: + +`date -d @1473305798` diff --git a/pages/osx/date.md b/pages/osx/date.md new file mode 100644 index 000000000..4f89139b8 --- /dev/null +++ b/pages/osx/date.md @@ -0,0 +1,19 @@ +# date + +> Set or display the system date. + +- Display the date using the default locale: + +`date +"%c"` + +- Display the date in UTC and ISO 8601 format: + +`date -u +"%Y-%m-%dT%H:%M:%SZ"` + +- Display the number of seconds since the unix epoch: + +`date +%s` + +- Juggle a timestamp representing seconds since the Unix expoch to a date: + +`date -j -r 1473305798` From cf551279355aaf1f3c18ea1a4be24034931bda6e Mon Sep 17 00:00:00 2001 From: Agniva De Sarker Date: Thu, 6 Oct 2016 10:02:39 +0530 Subject: [PATCH 2/3] Update the last example to explain the -r flag --- pages/osx/date.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/osx/date.md b/pages/osx/date.md index 4f89139b8..ee91c1add 100644 --- a/pages/osx/date.md +++ b/pages/osx/date.md @@ -14,6 +14,6 @@ `date +%s` -- Juggle a timestamp representing seconds since the Unix expoch to a date: +- Perform a reverse conversion from a unix timestamp to a date: -`date -j -r 1473305798` +`date -r 1473305798` From c9c5f9edc528d1a4baebe25109d8e8c82d8c421d Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Thu, 6 Oct 2016 12:05:12 +0100 Subject: [PATCH 3/3] date.md: another attempt at clarifying the descriptions --- pages/linux/date.md | 8 ++++---- pages/osx/date.md | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pages/linux/date.md b/pages/linux/date.md index dcba66c1e..577450fc2 100644 --- a/pages/linux/date.md +++ b/pages/linux/date.md @@ -2,18 +2,18 @@ > Set or display the system date. -- Display the date using the default locale: +- Display the current date using the default locale's format: `date +"%c"` -- Display the date in UTC and ISO 8601 format: +- Display the current date in UTC and ISO 8601 format: `date -u +"%Y-%m-%dT%H:%M:%SZ"` -- Display the number of seconds since the unix epoch: +- Display the current date as a Unix timestamp (seconds since the Unix epoch): `date +%s` -- Convert a unix epoch timestamp to a date: +- Display a specific date (represented as a Unix timestamp) using the default format: `date -d @1473305798` diff --git a/pages/osx/date.md b/pages/osx/date.md index ee91c1add..4d694337f 100644 --- a/pages/osx/date.md +++ b/pages/osx/date.md @@ -2,18 +2,18 @@ > Set or display the system date. -- Display the date using the default locale: +- Display the current date using the default locale: `date +"%c"` -- Display the date in UTC and ISO 8601 format: +- Display the current date in UTC and ISO 8601 format: `date -u +"%Y-%m-%dT%H:%M:%SZ"` -- Display the number of seconds since the unix epoch: +- Display the current date as a Unix timestamp (seconds since the Unix epoch): `date +%s` -- Perform a reverse conversion from a unix timestamp to a date: +- Display a specific date (represented as a Unix timestamp) using the default format: `date -r 1473305798`