Open arooni opened 6 years ago
Well, I don't know if it's helpful but there's also time
:
$ dateutils.ddiff time 14:00:00
23430s
which contrasts the current time to the time specified. Now if you guarantee that you mean tomorrow at that time, you could add 86400 seconds to the output but then again you could have just written:
$ dateutils.ddiff now `dateutils.dconv tomorrow`T14:00:00
109644s
which uses your shell's substitution capabilities and, because of two independent invocations, suffers from a race condition at around midnight.
that works! thanks!
also; anyway to get distance between now and end of month (or beginning of next month)? i don't see it on the man page under " DATE/TIME can also be one of the following specials
DATE/TIME can also be one of the following specials
- `now' interpreted as the current (UTC) time stamp
- `time' the time part of the current (UTC) time stamp
- `today' the current date (according to UTC)
- `tomo[rrow]' tomorrow's date (according to UTC)
- `y[ester]day' yesterday's date (according to UTC)
"
No, there are no specials for that but there's a much more powerful tool to achieve this: dateround
(possibly available to you as dateutils.dround
)
## end of month
$ dateutils.dround today +31
## first of next month
$ dateutils.dround today +1
So assuming midnight on one of these events you could do:
$ dateutils.ddiff now `dateutils.dround today +31`T00:00:00
1183630s
Similarly for first of next month.
thanks -- that worked great!
david parkinson founder - aroonilabs.com blog - brofist.com twitter - @brofist https://twitter.com/brofist
On Wed, Oct 17, 2018 at 2:13 AM Sebastian Freundt notifications@github.com wrote:
No, there are no specials for that but there's a much more powerful tool to achieve this: dateround (possibly available to you as dateutils.dround)
end of month
$ dateutils.dround today +31
first of next month
$ dateutils.dround today +1
So assuming midnight on one of these events you could do:
$ dateutils.ddiff now
dateutils.dround today +31
T00:00:00 1183630sSimilarly for first of next month.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hroptatyr/dateutils/issues/87#issuecomment-430516017, or mute the thread https://github.com/notifications/unsubscribe-auth/AAh-e_8hCstBhElJr4C7_NWdSuYwOFxZks5ultiSgaJpZM4XYR2w .
[I] ✘ ~/bin dateutils.ddiff now tomorrow -f '%H hours, %M minutes, %S seconds.' 24 hours, 0 minutes, 0 seconds.
[I] ~/bin dateutils.ddiff now 2018-10-12T8:00:00 -f '%H hours, %M minutes, %S seconds.' 11 hours, 55 minutes, 15 seconds.
[I] ~/bin dateutils.ddiff now tomorrowT8:00:00 -f '%H hours, %M minutes, %S seconds.' ddiff: cannot make sense of `tomorrowT8:00:00' using the given input formats
today, now, and tomorrow work .. but is there a way to specify a specific time so i can get an hour, minute, seconds output?
I know I could run [I] ~/bin dateutils.ddiff now 2018-10-12T8:00:00 -f '%H hours, %M minutes, %S seconds.' 11 hours, 54 minutes, 51 seconds.
but I'm hoping not to have to specify the date by hand, and was hoping to append a specific time to today/tomorrow. thanks!