-1

JqueryUIの日付ピッカーはdd.mm.yyyy形式では機能しません。それを機能させる方法はありますか?

テストしてください

Date 1: <input type="text" name="date1" id="date1" class="date" value="">
Date 2: <input type="text" name="date2" id="date2" class="date" value="">
$(document).ready(function(){ 
$('.date').each(function(){
        $(this).datepicker({ changeMonth: true,changeYear: true,maxDate: "+0D"});
        $(this).datepicker( "option", "dateFormat", "dd.mm.yyyy" );
    });  });

http://jsfiddle.net/sateeshchandrach/T2u5v/3/

申し訳ありませんが、質問を再度更新しました。JqueryUIを日付形式の4yで動作させる方法はありますか。

4

2 に答える 2

1

独自のカスタム形式を Jquery UI に渡すことができます。

dateFormat では、YY の代わりに YYYY を使用しています。

http://docs.jquery.com/UI/Datepicker/formatDateのドキュメントには、適切な形式が含まれています。

y - 年 (2 桁) yy - 年 (4 桁)

コードは次のようになります。

元:

$(document).ready(function(){ 
   $("#date").datepicker({ changeMonth: true,changeYear: true,maxDate: "+0D",dateFormat: "dd.mm.yy" });
  });

http://jsfiddle.net/T2u5v/4/

于 2013-01-12T00:24:21.893 に答える
1

日付の形式が間違っています。

JS:

$( "#datepicker" ).datepicker();
$( "#datepicker" ).datepicker( "option", "dateFormat", "dd.mm.yy" );

HTML

<p>Date: <input type="text" id="datepicker" size="30" /></p>

フィドルの例: http://jsfiddle.net/9EhDx/

有効な日付フォーマット文字列のリストは、JQuery formatdateドキュメントにあります。

The format can be combinations of the following:
    d - day of month (no leading zero)
    dd - day of month (two digit)
    o - day of the year (no leading zeros)
    oo - day of the year (three digit)
    D - day name short
    DD - day name long
    m - month of year (no leading zero)
    mm - month of year (two digit)
    M - month name short
    MM - month name long
    y - year (two digit) 
    yy - year (four digit)
    @ - Unix timestamp (ms since 01/01/1970)
    ! - Windows ticks (100ns since 01/01/0001)
    '...' - literal text
    '' - single quote
    anything else - literal text
于 2013-01-12T00:20:46.643 に答える