How to make jqueryUI datepicker submit in a different format than what is being displayed?

后端 未结 7 1529
不思量自难忘°
不思量自难忘° 2020-12-29 18:14

I\'m working on some internationalization using jQueryUI. I have a DatePicker control on a form that is properly working in the French language.

When I select a dat

7条回答
  •  误落风尘
    2020-12-29 18:49

    As @Pawel-Dyda mentioned, There's a

    getDate() method

    var currentDate = $( ".selector" ).datepicker( "getDate" );
    

    Here's an example of what it returns: Wed Jan 20 2016 00:00:00 GMT+0300.

    You can parse it in Javascript, PHP, in SQL or whatever.


    MySQL parsing examlple:

    select str_to_date('Wed Jan 20 2016 00:00:00 GMT+0300','%a %b %d %Y %H:%i:%s');
    

    Returns:

    2016-01-20 00:00:00
    

提交回复
热议问题