-
Notifications
You must be signed in to change notification settings - Fork 2
/
README
64 lines (50 loc) · 1.74 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
dateutils
=========
A small collection of utilities for manipulating dates from the
command line.
For each utility, the command line arguments can be any date format
understood by the date(1) command, and relative dates are relative to
the current time (unless otherwise noted). When a utility displays a
time, it supports a --format/-f option that accepts any format
understood by date(1).
The utilities are:
dateadd
-------
Sum up relative times and dates to get the new date and time.
The command assumes the default starting time is the current time,
then each argument is added in turn. A non-relative date (such as 'Jan
23 2009') resets the result to that time; this is mostly used only in
the first argument.
The output format of the date can be set with the --format/-f
option.
Example:
$ dateadd '2010/01/01' '+2 month'
Mon, 01 Mar 2010 00:00:00 -0500
$ dateadd '2010/01/01 00:00:00 UTC' '+2 month'
Wed, 03 Mar 2010 19:00:00 -0500
$ dateadd '2010/01/01' '+2 month' -- '-1 day'
Sun, 28 Feb 2010 00:00:00 -0500
$ TZ= dateadd '2010/01/01 00:00:00 UTC' '+2 month' '+3 hours'
Mon, 01 Mar 2010 03:00:00 +0000
$ dateadd -f '%Y/%m/%d' '2010/01/01' '+2 month'
2010/03/01
datediff
--------
Calculate the difference between two dates, and print the result in a
human readable form (such as '1 year 2 months 3 days 1 hour 15
seconds').
Example:
$ datediff '2010/01/01 00:00:00 UTC' 2010/03/01
2 months 5 hours
$ TZ= datediff '2010/01/01 00:00:00 UTC' 2010/03/01
2 months
Installation
============
Get the latest code from GitHub, bootstrap, configure, make, make
install:
$ git clone git://github.com/alanfalloon/dateutils.git
$ cd dateutils
$ ./bootstrap
$ ./configure
$ make
$ make install