2012-04-09 3 views
2

を変更しない、私は、2つの日付の入力を持ってjqueryのUIのDatePickerのフォーマットは私のウェブサイトで

<label>From : </label><input class="datepicker" id="from" name="from" value="<?php echo $from;?>" size=11 type="text"> 
<label>To : </label><input class="datepicker" id="to" name="to" value="<?php echo $to ;?>" size=11 type="text"> 

とJavaScript部分で、私は次のコード

$(function() { 
    $(".datepicker").datepicker({ altFormat: 'yy-mm-dd' }); 
    //getter 
    var altFormat = $(".datepicker").datepicker("option", "altFormat"); 
    //setter 
    $(".datepicker").datepicker("option", "altFormat", 'yy-mm-dd'); 
    }); 

を持っている。しかし、私が選択したときyy-mm-ddの代わりに04/04/2012形式の日付を返します。

この問題をどのように解決すればよいですか?

ありがとうございました

答えて

0

Lol、ここでもう一度やります。まず第一に:

  • altFormatThe dateFormat to be used for the altField option. This allows one date format to be shown to the user for selection purposes, while a different format is actually sent behind the scenes. For a full list of the possible formats see the formatDate function

  • DATEFORMATThe format for parsed and displayed dates. This attribute is one of the regionalisation attributes. For a full list of the possible formats see theformatDatefunction.

を参照してくださいワーキングjsFiddle Here

あなたミグhtはまた私がfew minutes ago here, with more fiddlesを与えた答えを見たいと思う。

関連する問題