Reply To: How to compare dates in a IF statement in an Xlate

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf How to compare dates in a IF statement in an Xlate Reply To: How to compare dates in a IF statement in an Xlate

#57786
Rentian Huang
Participant

    set difference [expr {$newTime – $PV1_45}]  will not work, ie 20060101 – 20051231 = 8870, which is not you really want.

    you can do something like this:

    1. strip only the first 8 charactors from PV1-45 into a variable, ie. 20051011 -> @dischDate

    2. set diff [expr {([getclock] – [clock scan $dischDate])/86400}]  # 86400 sec per day

    Now $diff will give you the actual number of day difference.

    Sam   8)