File datecomp.icn

Summary

###########################################################################

	File:     datecomp.icn

	Subject:  Procedures for date comparison

	Author:   C. Scott McArthur  (kaltorak@poboxes.com)

	Date:     March 13, 1999 (03/13/1999)  :)
    
       Revised:  April 20, 1999 (04/20/1999)

###########################################################################

   This file is in the public domain.  But I will take money if you want :)

###########################################################################

   These procedures do simple date comparisons.  The first
   is a greater than [dgt(date1, date2)] the second is less than 
   [dlt(date1, date2)] the third is equaity [deq(date1, date2)], 
   and the fourth will determine if the date parameter
   in the future or not [futuredate(date1)] finally, pastdate  will 
   determine if date1 is less than &date [pastdate(date1)] (in the past)

   dgt will succede if date1 is greater than date2
   dlt will succede if date1 is less than date2
   deq will succede if date1 is equal to date2
   futuredate will succede if date1 is greater than &date
   pastdate will succede if date1 is less than &date

   The format for the parameters are strings of the format mm/dd/yyyy
   or yyyy/mm/dd (not my favorite, but this will comply with icons format
   of &date)

 NOTE:
   These functions will not work unless they are 
   formatted precicely as stated above (i.e., January first 12 ad needs to
   be passed as "01/01/0012" or "0012/01/01")

 REVISION: 
    Added procedure betweendates(date1, date2, date3)
    This function will return 1 if date 1 is between (or equal to)
    date2 and date3.
    Made all procedures that may need to reformat date call it by default.
    Now, reformatdate will only reformat the date if needed.  Otherwise
    it will just return what it was passed.
 
    April 20, 1999
      modified reformatdate to handle dates passed in as yyyymmdd with no '/'

###########################################################################
Procedures:
betweendates, deq, dgt, dlt, futuredate, getday, getmonth, getyear, pastdate, reformatdate

This file is part of the (main) package.

Source code.

Details
Procedures:

betweendates(date1, date2, date3)

######################################################
#  This procedure will determine if date1 is between
#  the CLOSED interval dates of date2 and date3
#  (include date2 and date3 in the interval)
#  This will fail if date3 < date2
######################################################


deq(date1, date2)

  returns if date1 is the same as date2, fails otherwise (copy and paste is cool)


dgt(date1, date2)


dlt(date1, date2)

#  returns if date1 is less than date2, fails otherwise


futuredate(date1)

 returns if date1 is in the future, fails otherwise


getday(thisdate)


getmonth(thisdate)


getyear(thisdate)


pastdate(date1)

 returns if date1 is in the past, fails otherwise


reformatdate(thisdate)



This page produced by UniDoc on 2021/04/15 @ 23:59:54.