I am attempting to create a date & time stamp variable called upload_timestamp that I need to format specifically as "m/d/Y, H:M:S" for the service I am uploading the data too. I am using Stata MP 17.0.
I've created a timestamp using:
Which creates:
Which is halfway there, but I am having trouble converting it into the format I require. I tried:
but it results in output missing the date half of the timestamp completely:
Any thoughts on how I can fix this? Thanks in advance!
I've created a timestamp using:
Code:
gen upload_timestamp = "`c(current_date)'"+"," +"`c(current_time)'"
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str20 upload_timestamp " 7 Dec 2022,17:21:51" " 7 Dec 2022,17:21:51" " 7 Dec 2022,17:21:51" " 7 Dec 2022,17:21:51" " 7 Dec 2022,17:21:51"
Code:
gen upload_timestamp = "`%tdN/D/CY date(c(current_date))'"+"_" +"`c(current_time)'"
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str9 upload_timestamp ",17:18:57" ",17:18:57" ",17:18:57" ",17:18:57" ",17:18:57"
Comment