--- On Fri, 11/9/09, Nikolaos Kanellopoulos wrote:
> I have two variables showing the starting and ending time
> of an event. These variables are of the form 10:30:25
> (hours:minutes:seconds).
>
> I want to estimate the difference between the two and
> display their difference in the same format.
*--------- begin example ------------
clear
input str8 time1 str8 time2
"10:30:25" "10:31:10"
end
gen t1 = clock(time1,"hms")
gen t2 = clock(time2,"hms")
format t1 %tc
format t2 %tc
gen diff_in_seconds = (t2-t1)/1000
list
*---------- end example -------------
Hope this helps,
Maarten
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/