title: Convert a PHP date format to a jQueryUI Datepicker date format
body: <p><strong>[EDIT] : I guess people had problem to understand exactly what I mean, so I completely rewrote my explanations.</strong></p>
  <p>I work on a project where users can define a date format used in the whole site. It uses PHP date format standard. For example : &quot;year-month-day&quot; is set by &quot;Y-m-d&quot;.</p>
  <p>PHP standard uses single-character symbols like <em>Y, m, d, F, j</em> to describe the date format. As seen in the documentation : <a href="http://www.php.net/manual/en/function.date.php" rel="nofollow noreferrer">http://www.php.net/manual/en/function.date.php</a></p>
  <p>Sometimes users can select a date thanks to a jQueryUI Datepicker. This component describes its date format with code-words like <em>yy, y, mm, dd, D, ...</em>
  <a href="http://api.jqueryui.com/datepicker/#utility-formatDate" rel="nofollow noreferrer">http://api.jqueryui.com/datepicker/#utility-formatDate</a></p>
  <p>I would like to display the dates in the same format for both PHP and the Datepicker.
  I mean that PHP should output the date as in the format set by user, AND the Datepicker should show the selected date in <strong>the same format</strong>.</p>
  <p>Given that:</p>
  <ol>
  <li><strong>The date format is necessarily described &quot;PHP style&quot;</strong></li>
  <li><strong>I can't know a priori which format was set by users</strong></li>
  </ol>
  <p>/!\ This not a problem of how to read/parse/display a date from a known format.</p>
  <p>Unfortunately, Javascript date format description is not the same as in PHP.
  For instance, these 2 date formats are equivalent but described differently in PHP and Javascript:</p>
  <ol>
  <li>PHP : Y-m-d (set by users)</li>
  <li>Javascript : yy-mm-dd</li>
  </ol>
  <p>As you can see, I cannot just configure the datepicker with the PHP date format, because it will be misunderstood, or not recognized at all.</p>
  <p>Someone (in answers below) adviced to create my own &quot;date format standard converter&quot;, matching each PHP symbol with its equivalent in JS date format description. Just like:</p>
  <ul>
  <li>Y =&gt; yy</li>
  <li>m =&gt; mm</li>
  <li>d =&gt; dd</li>
  <li>y =&gt; y</li>
  <li>z =&gt; o</li>
  <li>...</li>
  </ul>
  <p>And then replace each PHP symbol with the JS one. And so &quot;d/m/Y&quot; will be translated into &quot;dd/mm/yy&quot;, magically.</p>
  <p>But maybe somebody knows another proper way to make jQueryUI Datepicker understand PHP date format standard?</p>
  <p><strong>EDIT: I wrote a tutorial that explains both the problem and the solution.</strong> For further reading : <a href="http://tristan-jahier.fr/blog/2013/08/convertir-un-format-de-date-php-en-format-de-date-jqueryui-datepicker" rel="nofollow noreferrer">http://tristan-jahier.fr/blog/2013/08/convertir-un-format-de-date-php-en-format-de-date-jqueryui-datepicker</a></p>