Dear all,

I had a time variable in string format. I use clock() function to change it to Stata readable format.
Here is the problem:
RegistrationDate="2022-01-01 00:00:00" --> RegTime=31dec2021 23:59:33
My code is:
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str19 RegistrationDate
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
"2022-01-01 00:00:00"
end
g RegTime = clock(RegistrationDate, "YMD hms")
Thanks in advance,
Best regards,
Cu