From 8136ac19301be22a68a91ef60a1bd867cca4cd6c Mon Sep 17 00:00:00 2001 From: Daniel Compton Date: Thu, 8 Sep 2016 15:46:34 +1200 Subject: [PATCH] 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 a0fa47e793..dcba66c1e5 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 0000000000..4f89139b8d --- /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`