TCL function to get todays day minus 5

Clovertech Forums Cloverleaf TCL function to get todays day minus 5

Tagged: 

  • Creator
    Topic
  • #122043
    Drew Gross
    Participant

      I’m looking for a tcl script that will take today’s date and subtract 5 days from that and return that value.

    Viewing 3 reply threads
    • Author
      Replies
      • #122044
        James Cobane
        Participant

          In Tcl you can simply use the clock scan command:

          set myDate [clock scan “5 days ago”]

          That will return the clock value from 5 days ago that you can then format:

          clock format $myDate

           

          Jim Cobane – Henry Ford Health

        • #122045
          Paul Bishop
          Participant

            you can use the clock command for something like that.  there are other ways too, but this is the way I usually do it:

            #current date minus 5 years

            set todays_date_minus_5 [clock format [clock scan ” – 5 years”] -format “%Y%m%d”]

            there is also a clock add command:

            set todays_date_minus_5 [clock format [clock add [clock seconds] -5 years] -format “%Y%m%d”]

             

            Paul Bishop
            Carle Foundation Hospital
            Urbana, IL

          • #122046
            Jim Kosloskey
            Participant

              If this is for an Xlate, I have a reusable proc intended for this purpose. Arguments provide the offset desired among other things (like resultant format). If you would like a copy of that proc, email me.

              email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 60 years IT – old fart.

            • #122047
              Drew Gross
              Participant

                I got what I need using the above. Thank you all for the help! Much appreciated!!

                 

                Drew

            Viewing 3 reply threads
            • You must be logged in to reply to this topic.