I use the Linux date command regularly. Normally I use it to format current date, e.g.
date +"%Y-%m-%d"Yesterday, while writing a backup script, I found out that the command also understands simple English. E.g.
date +"%Y-%m-%d %H:%M:%S" --date "yesterday" date +"%Y-%m-%d %H:%M:%S" --date "-7days" date +"%Y-%m-%d %H:%M:%S" --date "-7days 00:00:00" date +"%Y-%m-%d %H:%M:%S" --date "2 weeks ago"This helps when I want a date that represents, say, 3pm yesterday.
No comments:
Post a Comment