Date format problems

3
I am developing a system using C # MVC and JQuery UI and at the moment I am having problems with date formats, in the inputs is the date in the correct format "dd / mm / yyyy" but the server is receiving the date in the format " mm / dd / yyyy ".

Apparently the culture of web.config is correct:

<globalization culture="pt-BR" uiCulture="pt-BR" enableClientBasedCulture="true"  requestEncoding="utf-8"/>

The Datepicker also seems to be in the correct format, as it is showing all the information of the months in Portuguese and when I select a date it comes in the correct format.

    
asked by anonymous 08.11.2014 / 02:11

2 answers

2

To work, now install the following NuGet package:

  

link

Do not forget to set BundleConfig.cs to add new scripts to your Views.

    
08.11.2014 / 03:08
0

Friend you can either convert it using javascript, from the current format to the server form.

  function converterData(dataString){
       split = dataString.split('/');
      return novadata = split[1] + "/" +split[0]+"/"+split[2];

    } 

or with C # (from server to jquery)

class Program
{
    static String Main(){
       string str = "11/30/2014";
       string[] data = str.Split('/');
       return data[1] + "/" + data[0] + "/" +data[2];  
    }
}
    
08.11.2014 / 03:33