Comments on: How to Work with Date and Time in Bash Using date Command https://www.tecmint.com/change-linux-system-date-and-time/ Tecmint - Linux Howtos, Tutorials, Guides, News, Tips and Tricks. Thu, 13 Jul 2023 22:11:36 +0000 hourly 1 By: Alexey https://www.tecmint.com/change-linux-system-date-and-time/comment-page-1/#comment-1901625 Thu, 20 Oct 2022 07:39:12 +0000 https://www.tecmint.com/?p=40735#comment-1901625 Thanks a lot, it’s a very useful article.

“echo $(( ( $(date -d “2020-11-10” “+%s”) – $(date -d “2020-11-01” “+%s”) ) / 86400))”

How do you calculate this number 86400, please?

]]>
By: leslie Satenstein https://www.tecmint.com/change-linux-system-date-and-time/comment-page-1/#comment-1395009 Thu, 26 Nov 2020 22:24:52 +0000 https://www.tecmint.com/?p=40735#comment-1395009 date +s is the number of seconds since 1 Jan 1970. Dividing the result by seconds per day will indicate the day count, the number of days since 1 Jan 1970. Why is this useful?

I want to run something every 11 days from the previous day. I determine the day-count (number of days) since 1 Jan 1970, add 11, and store the result in a file. When I run a cronjob to check today’s daycount against the saved value, subtraction can tell me if the period has expired or the number of days to go. If by chance, I did not boot my computer for 15 days, the day-count subtraction will be negative, and I will run my job, and then set the day-count to 11 past today.

]]>