Generate dates and times relative from now.
fromnow v0.1.1 (semver.org 2.0) Alberto Leal <firstname.lastname@example.org> (github.com/dashed) Generate dates and times relative from now. USAGE: fromnow [FLAGS] [OPTIONS] <duration>... FLAGS: -h, --help Prints help information -s, --subtract Subtract time spans/durations to generate date/time in the past. By default, time spans/durations are added. -V, --version Prints version information OPTIONS: -f, --format <format> Format specifier for the combined date and time output. Example output: July 5, 2016 9:36 PM Default is: %B %-d, %Y %-l:%M %p See: https://lifthrasiir.github.io/rust-chrono/chrono/format/strftime/index.html ARGS: <duration>... A duration/span of time. (Example: 3 hours) A duration is an integer number followed by time span units. (Example: 42 hours) There may be whitespace between the integer and the time span unit. Whitespace between <duration> items is optional (Example: 3hours30mins). There may be an ' and ' between duration items (Example: 42 days and 42 mins). Arguments may compose into a valid duration/time span; removing the need to enclose durations in quotes. Time span units are case-insensitive. Valid time span units and their abbreviations: weeks/week/wks/wk/w days/day/dys/dy/d hours/hour/hrs/hr/h minutes/minute/mins/min/m seconds/second/secs/sec/s milliseconds/millisecond/msecs/msec/ms
fromnow 6 hours fromnow 6 hours 42mins fromnow 6 hours 42mins 6 week fromnow 6 hours 42mins 6 week and 9000 secs fromnow 6 hours 42mins 6 week and 9000 secs -f "%B %-d, %Y %-l:%M %p"
| | **DATE SPECIFIERS:**
2001 | The full proleptic Gregorian year, zero-padded to 4 digits. 
20 | The proleptic Gregorian year divided by 100, zero-padded to 2 digits. 
01 | The proleptic Gregorian year modulo 100, zero-padded to 2 digits. 
07 | Month number (01--12), zero-padded to 2 digits.
Jul | Abbreviated month name. Always 3 letters.
July | Full month name. Also accepts corresponding abbreviation in parsing.
Jul | Same to
08 | Day number (01--31), zero-padded to 2 digits.
8 | Same to
%d but space-padded. Same to
Sun | Abbreviated weekday name. Always 3 letters.
Sunday | Full weekday name. Also accepts corresponding abbreviation in parsing.
0 | Sunday = 0, Monday = 1, ..., Saturday = 6.
7 | Monday = 1, Tuesday = 2, ..., Sunday = 7. (ISO 8601)
28 | Week number starting with Sunday (00--53), zero-padded to 2 digits. 
27 | Same to
%U, but week 1 starts with the first Monday in that year instead.
2001 | Same to
%Y but uses the year number in ISO 8601 week date. 
01 | Same to
%y but uses the year number in ISO 8601 week date. 
27 | Same to
%U but uses the week number in ISO 8601 week date (01--53). 
189 | Day of the year (001--366), zero-padded to 3 digits.
07/08/01 | Month-day-year format. Same to
07/08/01 | Same to
2001-07-08 | Year-month-day format (ISO 8601). Same to
8-Jul-2001 | Day-month-year format. Same to
| | TIME SPECIFIERS:
00 | Hour number (00--23), zero-padded to 2 digits.
0 | Same to
%H but space-padded. Same to
12 | Hour number in 12-hour clocks (01--12), zero-padded to 2 digits.
12 | Same to
%I but space-padded. Same to
pm in 12-hour clocks.
PM in 12-hour clocks.
34 | Minute number (00--59), zero-padded to 2 digits.
60 | Second number (00--60), zero-padded to 2 digits. 
026490000 | The fractional seconds (in nanoseconds) since last whole second. 
.026490 | Similar to
.%f but left-aligned. 
.026 | Similar to
.%f but left-aligned but fixed to a length of 3. 
.026490 | Similar to
.%f but left-aligned but fixed to a length of 6. 
.026490000 | Similar to
.%f but left-aligned but fixed to a length of 9. 
00:34 | Hour-minute format. Same to
00:34:60 | Hour-minute-second format. Same to
00:34:60 | Same to
12:34:60 AM | Hour-minute-second format in 12-hour clocks. Same to
| | TIME ZONE SPECIFIERS:
ACST | Formatting only: Local time zone name.
+0930 | Offset from the local time to UTC (with UTC being
+09:30 | Same to
%z but with a colon.
| | DATE & TIME SPECIFIERS:
Sun Jul 8 00:34:60 2001 |
ctime date & time format. Same to
%a %b %e %T %Y sans
2001-07-08T00:34:60.026490+09:30 | ISO 8601 / RFC 3339 date & time format. 
994518299 | UNIX timestamp, the number of seconds since 1970-01-01 00:00 UTC. 
| | SPECIAL SPECIFIERS:
%t | | Literal tab (
%n | | Literal newline (
%% | | Literal percent sign.
Direct downloads are available through the releases page.
If you're on OSX, you may install using Homebrew:
brew install https://raw.githubusercontent.com/dashed/fromnow/master/fromnow.rb
I'm aware there exists a
date command that does essentially the same thing.
However, there are different flavours of the
date command in OSX and linux. Example:
fromnow for my own usecases rather than making a bash script to 'monkeypatch' the