title: Is Excel/EPPlus number format compatible with DateTimeFormat.ShortDatePattern?
body: <p>I'm creating some Excel files using EPPlus within ASP.Net.  All is working well, except that in some cases, I need to show a short date format.  Using the EPPlus <code>NumberFormat</code>, I can apply a short date format:</p>
  
  <pre><code>ws.Column(1).Style.Numberformat.Format = "yyyy-MM-dd";
  </code></pre>
  
  <p>That outputs a date in my spreadsheets as <code>2015-07-21</code>.  Although this is universal, I would prefer a localised (user locale-based) format if possible. I can retrieve the user locale's short date format with this:</p>
  
  <pre><code>String s = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern;
  </code></pre>
  
  <p>For me in the UK, this returns <code>dd/MM/yyyy</code>.  Other authors using EPPlus refer to the the <a href="http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-376,%20Fourth%20Edition,%20Part%201%20-%20Fundamentals%20And%20Markup%20Language%20Reference.zip" rel="nofollow noreferrer">Open Office XML ECMA-376 spec</a> (50MB) for applying number formats.  Page 1768 shows this:</p>
  
  <p><a href="https://i.stack.imgur.com/EsNVe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EsNVe.png" alt="enter image description here"></a></p>
  
  <p>But the <code>m</code>'s here are all lower-case, which in .Net is not months but minutes, so is something wrong/non-compatible if I do this?  </p>
  
  <pre><code>ws.Column(1).Style.Numberformat.Format = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern;
  </code></pre>
  
  <p>I haven't the resources to test for every culture's date format, so am wondering whether anything is wrong with my approach?  </p>
  
  <p>Or, should I cast the ShortDatePattern <code>ToLower</code> to disregard the upper-case <code>MM</code> as per the spec?  Excel (2013) itself uses lower case for custom dates formats, so I assume the lower-case approach is better?  I've done tests with both formats (using upper/lower case <code>mm</code>) and the result is the same, but the cross-culture thing concerns me.</p>