Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: calculating time difference


From   Shehzad Ali <drshehzad_ali@yahoo.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: calculating time difference
Date   Fri, 24 Aug 2012 16:17:48 +0100 (BST)

I think I got it. The clock() function returns time in milliseconds which I can convert to minutes and then calculate the difference in duration. However, if there is a direct method, that would be useful.

Thanks
Shehzad



----- Original Message -----
> From: Shehzad Ali <drshehzad_ali@yahoo.com>
> To: Stata List <statalist@hsphsun2.harvard.edu>
> Cc: 
> Sent: Friday, 24 August 2012, 15:50
> Subject: st: calculating time difference
> 
> Hi listers,
> 
> I want to calculate the duration between two time points (-time1- and -time2-). 
> The time variables are in string format and the variables appear in the format 
> of HH:MM. I tried the following but it doesn't help:
> 
> gen double clock1 = clock(time1,"hm")
> 
> When time1 is 10:20, the new var -clock1- is 37200000.
> 
> Any help would be appreciated.
> 
> Thank you
> Shehzad
> 
> *
> *   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/
> 

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index