Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Time of day


From   <[email protected]>
To   <[email protected]>
Subject   st: Time of day
Date   Thu, 28 Aug 2008 12:54:10 +0200

Dear Statalister,

I use Stata 10. I have a string variable, result_date, that records day, month, year, hours, minutes, seconds. It displays, 11.02.2008 08:21:00.000

I would like to generate a new variable that only indicates hours. I had a look at the ntimeofday, written by Nicholas J. Cox (findit ntimeofday), and issed the following command,

ntimeofday result_date, gen(ndatetime) s(dmy h mi s) n(h)

It runs ok, but listing some of these values gives me

list ndatetime in 1/2
  | ndatetime |
     |-----------|
  1. | 421760.35 |
  2. | 421759.92 |

I am not sure whether I am on the right track, and maybe all I am missing is to translate these numbers into hours? Any help would be greatly appreciated.

Best wishes,
Alexander Severinsen

*
*   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