Calculate date differences

Clovertech Forums Cloverleaf Calculate date differences

  • Creator
    Topic
  • #120397
    Charlie Bursell
    Participant

      Several have ask for a means to calculate date differences such as DOB in Years, months and days.  I have enclosed a proc to do that.  You can source this proc in a another proc or in Xlate like “source  $::HciSiteDir/scripts/dateDiff (Assumes stored in scripts directory.  Or you add it to a package and simply “package require”  FWIW, I have always had a package called myLib where I kept my own little functions.

      From the proc comments:

      # Name: dateDiff
      # Args: startDate (Could be DOB) required
      # endDate (Optional) Defaults to today’s date. Must be greater than startDate
      #
      # Returns: Elapsed YEARS, MONTHS and DAYS as a list
      #
      # Usage examples:
      #              lassign [dateDiff 20230115} yrs mos dys
      #             set variables to elapsed Years, Months, Days since 20230115
      #
      #             lassign [dateDiff 20230115} yrs mos dys
      #            set variables to elapsed Years, Months, Days since 20230115
      #           to today’s date
      #
      #           lassign [dateDiff 20230115 20230416} yrs mos dys
      #          set variables to elapsed Years, Months, Days between 20230115
      #          and 20230115
      #

    Viewing 0 reply threads
    • Author
      Replies
      • #120398
        Charlie Bursell
        Participant

          Got the message:  Sorry, you are not allowed to upload this file type/

          Try again

          Will someone please let us know what types of files can we upload.

          Attachments:
          You must be logged in to view attached files.
      Viewing 0 reply threads
      • You must be logged in to reply to this topic.