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

date comparison, 2038 issue

Status
Not open for further replies.

ken2834

Technical User
Jun 26, 2006
27
US
I am doing a comparison of dates in an if statement...
matdate is a date in the format of "July 15, 2010".

set matdate1 [clock scan $matdate]
if {[clock seconds] < $matdate1} {
#run this code...
}

The first problem I encountered is I have some dates that exceed 2038. I get an "unable to convert" error for these. I was looking for a simple way to get today's date and test if matdate is greater than todays date. Any suggestions on alternatives? Thanks.
 
ActiveTcl Help: clock scan said:
Not all platforms can represent the years 38-70, so an error may result if these years are used.
So what about
Code:
if {[string range $matdate end-4 end]<2038 && [clock seconds]<[clock scan $matdate]} {
  ...
}

Franco
: Online engineering calculations
: Magnetic brakes for fun rides
: Air bearing pads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top