Forum OpenACS Q&A: Re: how to subtract very large integers in tcl

Collapse
Posted by abhishek kk on
these are actually datestamps!!
but is there any built-in tcl function for date subtraction???
if so do let me know!!
abhishek
Collapse
Posted by russ m on
if you format the timestamps as ISO 8601 point-in-time strings by inserting a "T" between the day and hours (eg "20040101T120000") then you can use [clock scan] to convert to the number of seconds since the epoch and calculate the difference there.

% expr [clock scan "20040101T120000"] - [clock scan "20031231T120000"]
86400

gives you the correct number of seconds between these timestamps.