I have date in the format of 10/2/23. How can I get the difference of 10/2/23 to todays date? Please advise.
Asked
Active
Viewed 40 times
-3
-
1duplicates: [Quickly calculate date differences](https://unix.stackexchange.com/q/24626/44425), [Calculate time difference between two dates](https://unix.stackexchange.com/q/539854/44425), [Date Difference Calculation](https://unix.stackexchange.com/q/317139/44425)... – phuclv May 22 '23 at 01:22
-
6is that day month year or month day year? – Jaromanda X May 22 '23 at 01:22
-
see also [Unix: how to get number of days from a given date like 10Dec2022](https://unix.stackexchange.com/questions/740516/unix-how-to-get-number-of-days-from-a-given-date-like-10dec2022) – steeldriver May 22 '23 at 01:23
-
This question does not show the first step effort. Perhaps ChatGPT make this all for you. – Thibault LE PAUL May 28 '23 at 19:13
1 Answers
0
Time diff in integral seconds or integral days:
$ echo $(($(date +%s -d "10/2/23") - $(date +%s)))
11485596
$ echo $((($(date +%s -d "10/2/23") - $(date +%s))/(24*60*60)))
132
stevea
- 316
- 1
- 6