Elapsed Between Dates

 

I do a lot of Genealogical research, mostly for my own family.  There are a lot of resources on the Internet now for performing computations on dates, but I started doing this sort of work long before those resources became plentiful, so I created this short utility program.  Originally written in BASIC and compiled with Microsoft's now abandoned Professional Development Environment (which originated as QuickBASIC), I converted it to COBOL now that I have GnuCOBOL available.  No more opening DOSBox to execute my original, compiled BASIC version.

To install the source program, and compile it, execute the bash script:  Elapsed.setup [md5: 038ea13e56f8fb572daae38718b87b20].  Right click and save the script in the location where you want the source program to reside, then execute it.  It will create a file containing the source program, then execute the GnuCOBOL compiler to compile it, and finally will execute the compiled program with an example date range.  The GnuCOBOL compiler must be installed prior to executing the bash script.  In order to execute the compiled program, my Y2K Date Routines must be installed on your computer and available through the COB_LIBRARY_PATH.

If you execute the program with no arguments, it will display the syntax and exit.  If one date is supplied, the current system date will be used for the second date.

jay@Phoenix $ ELAPSED
Syntax: mm/dd/yyyy mm/dd/yyyy                     
 -or-   mm/dd/yy mm/dd/yy [19 assumed for century]
 -or-   mm/dd/yyyy [system date used for 2nd date]
 -or-   mm/yyyy mm/yyyy [01 assumed for day value 
jay@Phoenix $ ELAPSED 4/22/63 
Period 04/22/1963 through 04/22/2021: 58 Years
jay@Phoenix $ ELAPSED 1/70 3/14/2020
Period 01/01/1970 through 03/14/2020: 50 Years, 2 Months, 13 Days

If you want to be able to execute the program from any location, move the object module (ELAPSED) to a location included in your $PATH.

Update 24 May 2018: Modified the argument retrieval logic to use DISPLAY/ACCEPT from argument, replacing the original logic which retrieved the entire commandline and parsed into separate fields.

Update 22 April 2021: Updated the argument date parsing and validation.


This page was last updated on April 22, 2021.