Faulty string to time conversion?


New Member

I have a question concerning converting a string to a time variable. I have start and end times in the format DMYhms saved as strings (originally saved in SPSS). These I want to convert to time variables. I do this by running these commands:

generate time_begun = clock(StartTime, "DMYhms")
format time_begun %tc

generate time_finished = clock(FinishTime, "DMYhms")
format time_finished %tc
But the conversion seems not to be accurate, Stata reports slightly different times than the original string contains. Any suggestions what is going on here?