dateplus

http://www.unixreview.com/documents/s=9083/ur0403c/
日付計算用ユーティリティ。C 版と awk 版がある。

 Here are the supported options (together with non-trivial examples):

            -b Basedate of today (or date specified)"
               since Jan. 1, 0001"
               EXAMPLE: dateplus -b 20030818
                OUTPUT: 731445

            -h Usage brief or help.

            -H Full documentation including history with
               a short, two-paragraph discussion of the
               Gregorian correction to the Julian calendar
               made in 1582 and universally adopted in 1752.

            -J Julian (yyyyJJJ) to Gregorian (yyyymmdd)"
               EXAMPLE: dateplus -J 2003230
                OUTPUT: 20030818

            -j Julian day (ddd) for today or yyyymmdd"
               EXAMPLE: dateplus -j 20030818
                OUTPUT: 230

            -s Days 'since' (or until) yyyymmdd"
               EXAMPLE: The following command run 20030819:
                        dateplus -s 20000101
                OUTPUT: 1326 # number of days since Y2K

               EXAMPLE: The following command run 20030819:
                        dateplus -s 20040819
                OUTPUT: -366 # number of days until Aug. 19, 2004

            -t Tomorrow's date"

            -u Basedate of today (or date specified)"
               since Jan. 1, 1970 (Epoch date)"
               EXAMPLE: dateplus -u 19700131
                OUTPUT: 30

            -w Date's weekday
               EXAMPLE: dateplus -w 19700131
                OUTPUT: Sat
               EXAMPLE: dateplus -w 17760704
                OUTPUT: Thu

            -y Yesterday's date"

            Adjust days (date two month's ago):
              EXAMPLE: dateplus -1 20030101
               OUTPUT: 20021231

              EXAMPLE: dateplus -60 20030801
               OUTPUT: 20030602

            Adjust days with iteration (paydays):
              EXAMPLE: dateplus +14 20021231 26
               OUTPUT: 20030114
                       20030128
                       20030211
                       20030225
                       20030311
                       20030325
                       . . .
                       . .
                       .
                       20031202
                       20031216
                       20031230

            Return the 10 dates, 60-70 days before Aug. 1:
              EXAMPLE: dateplus -1 `dateplus -60 20030801` 10
               OUTPUT: 20030601
                       20030531
                       20030530
                       20030529
                       20030528
                       20030527
                       20030526
                       20030525
                       20030524
                       20030523

Unix Review の Shell Corner と Tool of the Month はなかなか面白い。