Dear Statalist,

I'm trying to change the format of my date variables which is currently a string variable (eg., "4/24/2018") to date format.
I tried the following code
Code:
format %tdCYND announcement_open_date
and get the message "string %fmt required for string variables."

Can anyone help me out with this?
Here's my data example.
Thanks.

----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str10(announcement_open_date announcement_close_date)
"4/23/2018"  "5/2/2018"  
"11/29/2017" "12/6/2017" 
"5/21/2018"  "6/5/2018"  
"4/9/2018"   "4/16/2018" 
"2/5/2018"   "2/20/2018" 
"7/31/2018"  "8/13/2018" 
"3/5/2018"   "3/23/2018" 
"1/17/2018"  "12/30/2018"
"1/12/2018"  "1/23/2018" 
"4/27/2018"  "5/3/2018"  
"10/12/2017" "10/18/2017"
"1/8/2018"   "1/17/2018" 
"5/7/2018"   "5/11/2018" 
"10/24/2017" "11/2/2017" 
"9/4/2018"   "9/10/2018" 
"2/28/2018"  "3/14/2018" 
"3/22/2018"  "3/28/2018" 
"8/15/2018"  "12/31/2018"
"7/10/2018"  "7/14/2018" 
"8/21/2018"  "8/31/2018" 
"7/31/2018"  "8/20/2018" 
"2/1/2018"   "2/5/2018"  
"2/12/2018"  "2/16/2018" 
"3/8/2018"   "3/12/2018" 
"1/12/2018"  "1/18/2018" 
"6/11/2018"  "6/15/2018" 
"9/18/2018"  "10/9/2018" 
"8/27/2018"  "9/10/2018" 
"5/11/2018"  "5/18/2018" 
"2/14/2018"  "4/11/2018" 
"8/1/2018"   "8/20/2018" 
"2/15/2018"  "6/29/2018" 
"1/2/2018"   "1/22/2018" 
"12/1/2017"  "1/2/2018"  
"2/13/2018"  "2/27/2018" 
"4/3/2018"   "4/10/2018" 
"4/16/2018"  "4/30/2018" 
"9/8/2018"   "9/17/2018" 
"3/7/2018"   "3/13/2018" 
"6/22/2018"  "6/28/2018" 
"11/8/2017"  "11/17/2017"
"9/11/2018"  "9/14/2018" 
"8/24/2018"  "9/5/2018"  
"9/4/2018"   "9/17/2018" 
"3/21/2018"  "3/30/2018" 
"2/9/2018"   "2/28/2018" 
"9/11/2018"  "9/18/2018" 
"9/19/2018"  "10/3/2018" 
"5/11/2018"  "5/21/2018" 
"12/8/2017"  "12/31/2018"
"9/18/2018"  "9/24/2018" 
"4/14/2018"  "4/23/2018" 
"4/11/2018"  "4/16/2018" 
"4/26/2018"  "5/9/2018"  
"8/8/2018"   "8/14/2018" 
"11/16/2017" "12/8/2017" 
"12/15/2017" "12/21/2017"
"2/1/2018"   "2/14/2018" 
"4/16/2018"  "4/20/2018" 
"2/3/2018"   "2/16/2018" 
"1/12/2018"  "1/19/2018" 
"1/26/2018"  "2/2/2018"  
"9/22/2018"  "10/9/2018" 
"7/26/2018"  "8/1/2018"  
"12/1/2017"  "12/11/2017"
"10/16/2017" "10/26/2017"
"1/12/2018"  "1/19/2018" 
"5/10/2018"  "5/16/2018" 
"5/18/2018"  "5/30/2018" 
"1/24/2018"  "2/9/2018"  
"6/14/2018"  "7/5/2018"  
"5/1/2018"   "5/10/2018" 
"3/28/2018"  "4/17/2018" 
"5/14/2018"  "5/18/2018" 
"7/13/2018"  "8/2/2018"  
"10/5/2017"  "10/11/2017"
"7/5/2018"   "7/16/2018" 
"8/7/2018"   "8/20/2018" 
"6/11/2018"  "6/15/2018" 
"10/10/2017" "10/16/2017"
"2/8/2018"   "2/14/2018" 
"3/8/2018"   "3/14/2018" 
"9/18/2018"  "9/18/2018" 
"10/19/2017" "10/30/2017"
"9/20/2018"  "9/26/2018" 
"6/27/2018"  "7/9/2018"  
"9/14/2018"  "9/25/2018" 
"4/11/2018"  "4/13/2018" 
"2/15/2018"  "2/20/2018" 
"10/20/2017" "11/2/2017" 
"9/19/2018"  "9/26/2018" 
"5/18/2018"  "5/24/2018" 
"4/10/2018"  "4/23/2018" 
"7/6/2018"   "7/13/2018" 
"9/4/2018"   "9/10/2018" 
"4/25/2018"  "5/8/2018"  
"10/23/2017" "11/7/2017" 
"2/1/2018"   "2/28/2018" 
"4/3/2018"   "4/10/2018" 
"4/25/2018"  "5/1/2018"  
end
------------------ copy up to and including the previous line ------------------