title: .net spitting out different date format between localhost and azure website
body: <p>I have an issue where when I run my web app from VS2013 it gives me one date format and when I address it deployed on Azure it gives me a completely different date format.</p>
  
  <p>Here is an example:
  top: running on Azure; bottom: running locally from VS
  <a href="https://i.stack.imgur.com/qGiZQ.jpg" rel="nofollow noreferrer">http://i.stack.imgur.com/qGiZQ.jpg</a>
  <img src="https://i.stack.imgur.com/qGiZQ.jpg" alt="enter image description here"></p>
  
  <p>This happens when using Canadian (en-CA) culture in the browser.</p>
  
  <p>Before appearing on the UI, they are delivered as strings into custom element attributes together with all the other data, then parsed by jquery.</p>
  
  <p>The relevant code in the model looks like this:</p>
  
  <pre><code>dynamic dynEffectiveStartDate
  if (blah blah) 
  {
       dynEffectiveStartDate = object.EffectiveStartDate.Value.ToString("MM/dd/yyyy");
  }
  else
  {
       dynEffectiveStartDate = DateTime.Today.ToString("MM/dd/yyyy");
  }
  var dataStruct = new
  {
       StartDate = dynEffectiveStartDate,
       EndDate = dynEffectiveEndDate,
       SomeStuff = anotherImportantDataString,
       DataStore = someMoreImportantData
  };
  …
  someObject.serializedData = javascriptserializer.Serialize(dataStruct);
  …
  </code></pre>
  
  <p>Later I use <em>$.datepicker.parsedate("mm/dd/yy", value)</em> in the UI to deliver the current value to the appropriate editor, but it collapses because there are dashes instead of slashes. Normally I would use <em>$.datepicker.setDefault($.datepicer.regional[cultureVariable]);</em> to format dates in the UI for the user and then use ("getDate") and <em>$.datepicker.formatDate("mm/dd/yyyy")</em> when recording it back into a custom attribute before post.</p>
  
  <p>So even when browser shows 31/12/2014 for Englishmen or Australians, I still post 12/31/2014 back to my controller.</p>
  
  <p>en-CA culture code, however, does one thing locally and a different thing remotely. So far as I know, <em>DateTime.Today.ToString("MM/dd/yyyy");</em> returns format "MM-dd-yyyy", which is vexing, because I need to parse it into a real date later on. There's no knowing whether it will start spitting out "dd-mm-yyyy" or "yyyy/mm/dd" if someone in China or wherever else uses the application.</p>
  
  <p>How can I make sure that the back end delivers the date format I tell it to? </p>