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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

clock date comparison

Status
Not open for further replies.

johnlopez2000

Programmer
Aug 2, 2002
90
0
0
US
I am attempting to start at one date and iterate to some final date, incrementing by one day per iteration. My code:

set xProcessingDate [clock format [expr [clock scan seconds]] -format %D]

set xStartDate [clock format [expr [clock scan 11/8/03]] -format %D]

while {$xStartDate <= $xProcessingDate} {
....
}

it would appear that it is incorrectly resolving the date.
.
.
.
I answered my own question, but decided to post for posterity:


% set xProcessDate [clock scan seconds]
1076964597
% set xStartDate [clock scan 11/8/03]
1068267600
% if {$xStartDate < $xProcessDate} { puts HI } { puts BYE }
HI
% set xStartDate [expr [clock scan seconds] + 86400]
1077051097
% if {$xStartDate < $xProcessDate} { puts HI } { puts BYE }
BYE

have a good one!


John Lopez
Enterprise PDM Architect
lopez.john@goodrich.com
 
Other possibilities with clock scan:
Code:
  puts [clock scan 2004-02-15]
  puts [clock scan now]
  puts [clock scan tomorrow -base [clock seconds]]
HTH

ulis
 
ulis,

thanks again.

John

John Lopez
Enterprise PDM Architect
lopez.john@goodrich.com
 
Thanks, I appreciate the help.


John Lopez
Enterprise PDM Architect
lopez.john@goodrich.com
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top