Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data comparision in Tcl/Tk

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi,

I would like to know if anyone has tcl/tk script for date comparision (e.g. Start date cannot be greater than end date and also needs to take care of date for each month etc) which can be included within xml code.

Thanks in advance,
Mehul.
 
I don't know what is needed inside xml code.
In pure Tcl you can write:
Code:
set start 01/01/02
set end 13/01/02 ;# buggy date
catch {
  if {[catch { set vstart [clock scan $start] } emsg]}   { error "end: $emsg" }
  if {[catch { set vend [clock scan $end] } smsg]}   { error "start: $smsg" }
  if {$vend < $vstart}   { error &quot;end < start&quot; }
} msg
if {$msg != &quot;&quot;} { puts $msg }
The last
Code:
if
fires in case of error.
I used
Code:
catch
inside
Code:
catch
to have only one final test.
The real job is done by the
Code:
clock scan
command.

ulis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top