Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Difference between times


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: Difference between times
Date   Fri, 11 Sep 2009 22:52:16 +0000 (GMT)

--- On Fri, 11/9/09, Nikolaos Kanellopoulos wrote:
> However, can the final result appear in the format of
> HH:MM:SS? In your example something like 00:00:45?

*--------- begin example -----------------------
clear
input t
3600
5400
10800
1810
end

gen h = string(floor(t/3600))
gen m = string(floor(mod(t,3600)/60))
gen s = string(mod(t,60))
gen diff_reformatted = h + ":" + m + ":" + s
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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index