title: How use a specific CultureInfo in Asp.net Web API
body: <p>I've recently added WEB API to an existing VS desktop application and everything worked fine, until yesterday when I had to add a GET method that took three parameters, one of them a Date.
  Well, at first I thought that that was going to be a piece of cake, but much to my surprise I noticed that when I sent 2014/07/09 (9th July) on the server where the application was installed it was treated like 2014/09/07 (7th September) and for that reason all my comparisons never worked.</p>
  
  <p>I have tried things like changing from a GET method to a POST method, changing my Regional and Language Options settings to the same on the server, passing the date as a String a created a Datetime object on the server using the parts of the string. Unfortunately none of them worked.</p>
  
  <p>Then I remember that this desktop application have some methods on its WCF project (which I'm passing now to web API) that passed dates with no problem at all. Looking in the code for a while I found that they used something like this on every class of they WCF project that uses dates:</p>
  
  <pre><code>Imports System.Globalization
  Imports System.Security.Permissions
  Imports System.Threading
  
  Public Class ServicioRemotoVentas
      Implements IServicioRemotoVentas        
      Public Sub New()
          MyBase.New()
          Thread.CurrentThread.CurrentCulture = New CultureInfo("es-PE", False)
      End Sub
  </code></pre>
  
  <p>Surely this <strong>Thread.CurrentThread.CurrentCulture = New CultureInfo("es-PE", False)</strong>, must be there for something.
  Now I would like to know if you have used something like that in Web API before? if so how and where did you put such a configuration.</p>
  
  <p>These are the settings on my pc :</p>
  
  <p><img src="https://i.stack.imgur.com/baL3o.jpg" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/yr80j.jpg" alt="enter image description here"></p>
  
  <p>And these are the server settings:</p>
  
  <p><img src="https://i.stack.imgur.com/6pjFY.jpg" alt="enter image description here">
  <img src="https://i.stack.imgur.com/AX0hB.jpg" alt="enter image description here"></p>
  
  <p>I almost forgot to mention that I pass all the dates using this format <strong>yyyy/M/d</strong> with all the other parameters using json.
  Is it perhaps that when the string is deserialized in the Web API this is done using the <strong>system date format</strong> because I haven't specify the culture info to use?? or maybe it is a Json error when trying serialize/deserialize the dates??</p>
  
  <p>As always, any advice or resources you could provide would be greatly appreciated.</p>