Subtracting Days

  • Creator
    Topic
  • #48915
    Randy Colella
    Participant

    How do I take a date (not the current date) and subtract it from another date to see how many days have elapsed.

    I cannot use the “20061101 – 20061031” format because in this case it would give me 70 days due to the month change.

Viewing 1 reply thread
  • Author
    Replies
    • #60101
      Steve Carter
      Participant

      There may be an easier way, but this will work:

      set today [clock scan “20061128”]

      set lastWeek [clock scan “20061121”]

      set elapsedSecs [expr $today – $lastWeek]

      set numDays [expr $elapsedSecs / 86400]

      Steve

    • #60102
      Randy Colella
      Participant

      Thanks a lot Steve.

      Randy Colella

      Massachusetts Eye & Ear Infirmary

      Boston, MA

Viewing 1 reply thread
  • The forum ‘Cloverleaf’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,293
Replies
34,435
Topic Tags
286
Empty Topic Tags
10