更改jQuery日期选择器格式 [英] Change jquery date picker format

查看:104
本文介绍了更改jQuery日期选择器格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,以下是jquery日期选择器代码.它以以下格式显示日期:

Hello Following is jquery date picker code. It's showing date following format:

day/month/year

如何将这种格式更改为该格式?

How do i change this format to that format ?

day-month-year

完整的Jquery代码:

<!doctype html>
<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.10.4/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.4/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>

推荐答案

关于该主题的文章很多.

There are a lot of post about that topic.

var date = $('#datepicker').datepicker({ dateFormat: 'dd-mm-yy' }).val();

可在此处获得更多常规信息:

More general info available here:

jQuery UI DatePicker-更改日期格式

这篇关于更改jQuery日期选择器格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆