I have a $due_date of 15-Mar-2000 and $todays_date is (hypothetically)
07-Mar-2000 (in whateve format). I would want to know that I am 14 (or
less) from being overdue.
From reading the man pages I believe I should be able to use [clock
format] to convert 15-Mar-2000 into something I can compare to todays
date using a simple =< if statement. However, I am not exactly sure
how to go about it. Can anybody give me an example of how to convert
that date into something I can compare (within days) to whatever the
current date is?
Thanks in advance,
Daniel Alexander
Sent via Deja.com http://www.deja.com/
Before you buy.
Daniel Alexander <alex...@my-deja.com> wrote in message
news:828ptk$ard$1...@nnrp1.deja.com...
# Return -1 if date1 < date2, 0 if date1==date2, 1 if date1 > date2.
proc datecompare {date1 date2} {
regsub -all -- - $date1 " " date1
regsub -all -- - $date2 " " date2
set date1_t [clock scan $date1]
set date2_t [clock scan $date2]
if {$date1_t < $date2_t} {
return -1
} elseif {$date1_t > $date2_t} {
return 1
}
return 0
}
set due_date "15-Mar-2000"
set todays_date [clock format [clock seconds] -format "%m-%b-%Y"]
puts "comparison: [datecompare $todays_date $due_date]"
-=- D. J.
In article <828ptk$ard$1...@nnrp1.deja.com>,
Daniel Alexander <alex...@my-deja.com> wrote:
> I need to compare 2 dates where one is in the format dd-Mmm-yyy
> ($due_date) to see if $todays_date is within 14 days (2 weeks) of
> approaching $due_date. This is going to be used to scan records in a
> database to show me which ones are coming due in the next 14 days so I
> know they are "hot". Example:
>
> I have a $due_date of 15-Mar-2000 and $todays_date is (hypothetically)
> 07-Mar-2000 (in whateve format). I would want to know that I am 14 (or
> less) from being overdue.