0

JQuery カレンダーの Datepicker を使用していますhttp://jqueryui.com/datepicker/ 日は英語で表示されますが、別の言語で表示する必要があります。これを達成する方法はありますか?

また、日付形式は mm/dd/year ですが、mm-dd-year のようにしたいです。これは、この形式を使用する記述されたコードがいくつかあり、私はそれにアクセスできないためです。これをどうにか変更できますか?

ありがとう

4

2 に答える 2

1

このカレンダー言語を使用する言語を変更する場合

日付形式を変更するには、この日付形式を使用します

日付用

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Datepicker - Format date</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function() {
$( "#datepicker" ).datepicker();
$( "#format" ).change(function() {
$( "#datepicker" ).datepicker( "option", "dateFormat", $( this ).val() );
});
});
</script>
</head>
<body>
<p>Date: <input type="text" id="datepicker" size="30" /></p>
<p>Format options:<br />
<select id="format">
<option value="mm/dd/yy">Default - mm/dd/yy</option>
<option value="yy-mm-dd">ISO 8601 - yy-mm-dd</option>
<option value="d M, y">Short - d M, y</option>
<option value="d MM, y">Medium - d MM, y</option>
<option value="DD, d MM, yy">Full - DD, d MM, yy</option>
<option value="'day' d 'of' MM 'in the year' yy">With text - 'day' d 'of' MM 'in the year' yy</option>
</select>
</p>
</body>
</html>

言語用

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Datepicker - Localize calendar</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="jquery.ui.datepicker-ar.js"></script>
<script src="jquery.ui.datepicker-fr.js"></script>
<script src="jquery.ui.datepicker-he.js"></script>
<script src="jquery.ui.datepicker-zh-TW.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function() {
$( "#datepicker" ).datepicker( $.datepicker.regional[ "fr" ] );
$( "#locale" ).change(function() {
$( "#datepicker" ).datepicker( "option",
$.datepicker.regional[ $( this ).val() ] );
});
});
</script>
</head>
<body>
<p>Date: <input type="text" id="datepicker" />&nbsp;
<select id="locale">
<option value="ar">Arabic (‫(العربية</option>
<option value="zh-TW">Chinese Traditional (繁體中文)</option>
<option value="">English</option>
<option value="fr" selected="selected">French (Français)</option>
<option value="he">Hebrew (‫(עברית</option>
</select></p>
</body>
</html>
于 2013-09-11T08:20:31.953 に答える
0

dateFormatを変更するには、これを使用します

$( ".selector" ).datepicker({ dateFormat: "mm-dd-yy" });

ドキュメントで、言語を変更するためのローカリゼーションを探します

于 2013-09-11T08:14:47.743 に答える