2

私のWebサイトには、2つの日付入力があります。

 <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ではなく2012年4月4日の形式の日付が返されます。

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

ありがとう

4

1 に答える 1

0

笑、また行きます。初めに:

  • altFormat :The 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

  • dateFormat : The 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の作業を参照してください

数分前に私がここで与えた答えを、より多くのフィドルで見たいと思うかもしれません。

于 2012-04-09T20:22:45.013 に答える