Fix incomplete character string for year "2016" from "0016" in R : <p>I've tried to find another question like this one but there doesn't seem to be one out there... My question is simple:</p>

<p>I have a data frame that looked like this but I want the format to read YYYY-MM-DD:</p>

<pre><code>&gt; df$Date
      Date    
1   10/23/16        
2   10/24/16         
3   10/25/16  
</code></pre>

<p>So I coded it up but it returned me this:  </p>

<pre><code>df$Date &lt;- strptime(as.character(df$Date), "%m/%d/%Y")
df$Date &lt;- format(df$Date, "%Y-%m-%d")

&gt; df$Date
      Date    
1   0016-10-23       
2   0016-10-24         
3   0016-10-25
</code></pre>

<p>Any ideas for how I can make the year 2016 instead of 0016?</p>

<p>Thanks! </p>
