From 23a1efa24912248539e22bcb02a4aad9df5de9e7 Mon Sep 17 00:00:00 2001 From: Bonnie I-Man Ng Date: Sat, 11 Mar 2023 16:21:26 +0000 Subject: [PATCH] add examples for 'current time point for N days ago or after N days' --- README.md | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index cb991ab..8a57426 100644 --- a/README.md +++ b/README.md @@ -1145,19 +1145,27 @@ date --date @1615852800 ``` -##### Print current time point for N days ago or after N days +##### Print current time point for N days ago or N days after ```bash -# get this time a day ago +# print current date first (for the following example) +date +"%F %H:%M:%S" +# 2023-03-11 16:17:09 + +# print the time that is 1 day ago date -d"1 day ago" +"%F %H:%M:%S" +# 2023-03-10 16:17:09 -# get this time tomorrow -date -d"-1 day ago" +"%F %H:%M:%S" - -# get this time 7 days ago +# print the time that is 7 days ago date -d"7 days ago" +"%F %H:%M:%S" +# 2023-03-04 16:17:09 -# get this time a week ago +# print the time that is a week ago date -d"1 week ago" +"%F %H:%M:%S" +# 2023-03-04 16:17:09 + +# add 1 day to date +date -d"-1 day ago" +"%F %H:%M:%S" +# 2023-03-12 16:17:09 ``` ##### wait for random duration (e.g. sleep 1-5 second, like adding a jitter)