Running date diff calculations in shell can be tedious. This is where this tiny tool comes in.
$ datediff2022-10-13T12:00:002022-10-15T19:00:0055h0m0s$ datediff-j2022-10-012022-10-15
{
"nanoseconds": 1209600000000000,
"seconds": 1209600,
"minutes": 20160,
"hours": 336,
"days": 14,
"readable": "336h0m0s"
}$ datediffnow2022-12-311768h59m0.48140367s$ datedifftodaytomorrow-pseconds-r086400$ datediffnownext_friday-phours-r263.98$ datedifftodaynext_odd_monday-phours144$ datedifftodaynext_year-11-11-pdays389.0416666666667Datediff tries to detect the format of the input date. The following are currently supported...
ThefollowingdatelayoutsaresupportedFormat|Layout|Comment---------------------+---------------------+----------------------------------------YYYY-MM-DDTHH:MM:SS|2006-01-02T15:04:05|YYYY-MM-DDTHH:MM|2006-01-02T15:04|YYYY-MM-DDTHH|2006-01-02T15|YYYY-MM-DD|2006-01-02|exacttimesetto0:00:00MM-DD|01-02|parserassumesdateisincurrentyearYYYYMMDD|20060102|MMDD|0102|acommandlinedatedifferArguments:
[<date-1>] date1, default 'now'
[<date-2>] date2, default 'tomorrow'
Flags:
-h, --helpShowcontext-sensitivehelp.
-p, --print="readable"printformat, displaydiffinaspecificunit,
can be: nano,sec,min,hours,days-r, --round=-1roundoutputvaluestoprecision-j, --jsonprintfulldiffinjsonformat-t, --tomlprintfulldiffastoml-l, --formatslistsupporteddateformats-v, --verboseverbosemode, defaultformatisjson, use-ttoswitch-V, --version-flagdisplayversion