使用Datepicker的默认示例:
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Datepicker - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
</head>
<body>
<p>Date: <input type="text" id="datepicker" /></p>
</body>
</html>
如何更改日期方式显示为yy-mm-dd?
谢谢:)
答案 0 :(得分:2)
添加dateFormat作为选项 -
$( "#datepicker" ).datepicker({ dateFormat : 'yy-mm-dd' });
答案 1 :(得分:1)
$( ".selector" ).datepicker({ altFormat: "yy-mm-dd" });