Hello everybody,
I am trying to get the difference in hours from two date variables (start and end). The tricky part is that I would like to keep the HH:MM:SS format (as string) for the outcome variable (duration_hms). Here is an example of my data. Note that some duration_hms' values are already available to demonstrate what I am looking for, and that the variable q_totalduration shows the difference already computed in minutes (in the case it might be of any help).
Thank you in advance to whoever is willing to help!
EDIT: start and end appear in the following format: 27may2021 19:11:55
I am trying to get the difference in hours from two date variables (start and end). The tricky part is that I would like to keep the HH:MM:SS format (as string) for the outcome variable (duration_hms). Here is an example of my data. Note that some duration_hms' values are already available to demonstrate what I am looking for, and that the variable q_totalduration shows the difference already computed in minutes (in the case it might be of any help).
Thank you in advance to whoever is willing to help!
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double q_totalduration str9 duration_hms double(start end) 10147.15 "" 1874780044000 1875388874000 22643.316666666666 "" 1874077736000 1875436336000 19854.283333333333 "" 1874253947000 1875445205000 19462.8 "" 1874279876000 1875447645000 24518.6 "" 1873978675000 1875449792000 5901.1 "" 1875107642000 1875461709000 20221.8 "" 1874248895000 1875462204000 25537.4 "" 1873983237000 1875515482000 11147.35 "" 1874950878000 1875619720000 23.183333333333334 "00:23:12" 1906135445000 1906136837000 64.75 "01:04:46" 1905955413000 1905959299000 61.983333333333334 "01:01:59" 1906105480000 1906109199000 49.9 "00:49:54" 1905756875000 1905759869000 32.13333333333333 "00:32:09" 1906011427000 1906013356000 125.2 "02:05:13" 1908081442000 1908088955000 90.61666666666666 "01:30:38" 1905777318000 1905782756000 34.983333333333334 "00:35:00" 1906132538000 1906134638000 39.733333333333334 "00:39:45" 1906388359000 1906390744000 37891.316666666666 "631:31:20" 1905608040000 1907881520000 18.683333333333334 "00:18:42" 1907076430000 1907077552000 46.5 "00:46:30" 1905860022000 1905862812000 end format %tc start format %tc end
Comment