title: Convert standard rails / ruby time to American format - dates getting mixed up
body: <p>I'm trying to convert the YYYY-MM-DD format in my forms and show views to MM/DD/YYYY - which is a pretty standard American date format. Not sure how to go about this - I thought that calling <code>.strftime("%m/%d/%Y")</code> on the date instance in /show would do the trick. Very confused - can't find documentation that explains how to convert dates that actually makes sense. I'm following this railscast: <a href="http://railscasts.com/episodes/213-calendars-revised" rel="nofollow">http://railscasts.com/episodes/213-calendars-revised</a></p>
  
  <p>If it helps, I'm using the jQuery datepicker and have this coffeescript:</p>
  
  <pre><code>jQuery -&gt;
    $('input.datepicker').datepicker()
      dateFormat: 'mm-dd-yy'
      weekStart: 0
      autoclose: true
  </code></pre>
  
  <p>_form</p>
  
  <pre><code>   &lt;%= f.label :due %&gt;&lt;br /&gt;
     &lt;%= f.text_field :due, { :class =&gt; 'datepicker' } %&gt;
  </code></pre>
  
  <p>The above enters the date with the MM/DD/YYYY format into the form, but it is saved as YYYY-MM-DD</p>
  
  <p>--- UPDATE/SOLUTION FOUND ---</p>
  
  <p>Turns out I was on the right track and not actually crazy. Part of my issue was that I was having a nil object problem which was remedied by calling <code>.try</code> in my views which will only run the method if not nil.</p>
  
  <pre><code>.try(:strftime, "%m/%d/%Y") 
  </code></pre>
  
  <p>Also - I installed the following gem: <code>gem 'american_date'</code> which automagically parses the dates. Works great in show views, but still getting YYYY-MM-DD in form views (edit view only).</p>