GnuCOBOL date and time routines Here are some programs that may help someone that needs a few date routines. I have them as executables to run on command line or in a script. I also have them as callable Subroutines from GnuCobol executables. The programs and purpose are listed below. They also have more information in the program as comments.
getdatex - batch (executable) program that will add a number argument to the current date and give you the new date. If you want to know the date from 31 days from now just execute it with: getdatex 31
getdatey - batch (executable) program that will subtract a number argument from the current date and give you the new date. If you want to know the date for 31 days ago from now just execute it with: getdatey 31
getdatez - batch (executable) program that will allow you to enter a date, add or subtract, and the number days, then it will give you the new date. This program will add or subtract a number of days for the gregorian date that is passed to this program and return the given new date: getdatez 24351225 - 600 . Will take the entered date and subtract 600 days and give you the new date. You can add or subtract.
sbrdatex - is a callable subroutine that does the same as getdatex.
sbrdatey - is a callable subroutine that does the same as getdatey.
sbrdatez - is a callable subroutine that does the same as getdatez.
weekday - batch (executable) program that will return the name of the Day of the week for a valid gregorian date passed as argument. To find day of week: weekday 20240212
sbrwkday - is a callable subroutine that does the same as weekday.
daysdiff - batch (executable) program that will return the nubmer of days bewteen two date: daysdiff 20010101 20240101
sbrdydff - is a callable subroutine that does the same as daysdiff.
secsbdt2 - batch (executalbe) program that will return the number of seconds between two dates and times. ccyymmdd hhmmss ccyymmdd hhmmss
sbrsbdt2 - is a callable subroutine that does the same as secsbdt2.
Notes: date limits are, minimum 16010101 maximum 99991231. time must conform to 24 hour clock min 000001 max 235959
The biggest possible number of days: daysdiff 16010101 99991231 = 3067670
The biggest time between dates: secsbdt2 16010101 000001 99991231 235959 = +0000000000000000000265046774398