title: Another dateTime question
body: <p>I currently have a date in this format </p>
  
  <pre><code>2010-03-03 10:39:18
  </code></pre>
  
  <p>which is a <code>TIMESTAMP</code> field in MySQL. I need to have the date in this format for a search engine called Solr:</p>
  
  <pre><code>1995-12-31T23:59:59Z
  </code></pre>
  
  <p>Here is some text from their website about dates:</p>
  
  <blockquote>
    <p>Solr expects dates to be in UTC when
    indexing. The format for this date
    field is of the form
    1995-12-31T23:59:59Z, and is a more
    restricted form of the canonical
    representation of dateTime
    <a href="http://www.w3.org/TR/xmlschema-2/#dateTime" rel="nofollow noreferrer">http://www.w3.org/TR/xmlschema-2/#dateTime</a>.
    The trailing "Z" designates UTC time
    and is mandatory. Optional fractional
    seconds are allowed:
    1995-12-31T23:59:59.999Z All other
    components are mandatory.</p>
  </blockquote>
  
  <p>I was given this code from another Q here on SO, but it doesn't work. Solr complains about an "invalid time string":</p>
  
  <pre><code>$solr_date = date('c', (strtotime($date_from_mysql)); // doesn't work
  </code></pre>
  
  <p>When echoing <code>$solr_date,</code> the trailing <code>Z</code> mentioned above isn't there. Thanks.</p>