util/time
tomocafe opened this issue · comments
Date and time utilities leveraging builtin printf
interface to strftime
.
bb_now [{+,-}N{s,m,h,D,W,M,Y}]
gives epoch timestamp relative to now. Multiple offsets can be given, e.g. +1d -2h
.
bb_timefmt
formats timestamp, defaults to now.
bb_parsetime YYYY/MM/DD[ hh:mm[:ss]]
gives epoch timestamp for date string. Separator character does not matter, but all values must be exact length (4 digits for year, 2 digits for month, etc.). Hours, minutes, seconds are optional and default to 00:00:00.
Done, except bb_parsetime
. Too complicated to do in pure bash, just use GNU coreutils date
.