Dear Stata Users
I want to convert a "string" variable into time. It works for most of the time except for 8 and 9am.
----------------------- copy starting from the next line -----------------------
------------------ copy up to and including the previous line ------------------
I would appreciate if anybody can tell me how to convert 8 and 9am into valid time variable.
Thank you.
I want to convert a "string" variable into time. It works for most of the time except for 8 and 9am.
Code:
tostring TRD_TM , generate(time) generate double time1= clock( time ,"hms#") format time1 %tc_HH:MM:SS
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long TRD_TM str9 time double time1 83049007 "83049007" . 83049007 "83049007" . 83049007 "83049007" . 92658513 "92658513" . 92915849 "92915849" . 92924443 "92924443" . 100013096 "100013096" 36013000 100013096 "100013096" 36013000 100013096 "100013096" 36013000 155834219 "155834219" 57514000 171030574 "171030574" 61830000 end format %tc_HH:MM:SS time1
I would appreciate if anybody can tell me how to convert 8 and 9am into valid time variable.
Thank you.
Comment