Loading ...
Sorry, an error occurred while loading the content.

11960Re: Date Math

Expand Messages
  • John Zeman
    Jun 5, 2004
    • 0 Attachment
      --- In ntb-clips@yahoogroups.com, "Walter" <wwabbott@m...> wrote:
      > Does anyone already have functions to calculate a date N number of
      > days in the past or future?
      >
      > Or Calculate the number of days between two dates?

      If you haven't found your answer yet, you can manipulate the time and
      date using the combination of a free command line utility program
      called TimeMath.exe and a clip. The zipped file containing
      TimeMath.exe can be downloaded from: (it's a long URL, so watch out
      for yahoo inserted line breaks)

      http://gearbox.maem.umr.edu/batch/f_w_util/Frank_Westlake-
      Freeware.html

      Unzip TimeMath (the zipped file includes a help file) and put it
      where you want it to be. In my clip example below I have it stored as
      C:\bin\TimeMath.exe

      Then with a clip similar to the one below, you can calculate dates
      and times in numerous ways. This sample clip tells TimeMath to
      calculate the DATE/TIME/DAY OF WEEK of one week ago today. The
      results are first sent to a temp file which NoteTab reads and
      displays in a NoteTab ^!Info box.

      From that point using other clip commands you could parse the
      returned dates/times however you want to.

      John

      ; Begin Clip ====================================

      ; run timemath and send date parms to it
      ; timemath output will be sent to a temp
      ; file named: c:\timemath.txt

      ^!DOS "C:\bin\TimeMath.exe" week-1 >c:\timemath.txt

      ; force notetab to wait till above is done
      ^!Wait

      ; open the file
      ^!Open "c:\timemath.txt"

      ; set var %results% to all text in file
      ^!Set %RESULTS%=^$GetText$

      ; close and discard file
      ^!Close Discard

      ; show date and time results in a NoteTab ^!Info box
      ^!Info ^%RESULTS%

      ; End Clip ======================================
    • Show all 8 messages in this topic