如何更改日期格式 [英] How to Change the Date Format

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

问题描述

在我的网页中,我有日期字段.当用户键入日期时,格式如

13-4-2012,13.4.2012所有这些都自动更改了此格式

2012年4月13日

并且不允许键入字母,并且仅允许日期.如何使用Javascript代码做到这一点.请任何人帮助我

谢谢您.

In my web page I have date field. When the user type date such format like

13-4-2012,13.4.2012 This are all automatically changed this format

04/13/2012

And Which is not allowed to type alphabets,And It allow only dates. How to do it using Javascript code. Please help me anybody

Thanking you

推荐答案

您可以使用此Java脚本代码,其中datepicker是保存日期的控件的ID.

You can use this java script code,where datepicker is the id of your control which hold the date.

<script type="text/javascript">


(函数(){


( ' #datepicker').datepicker({dateFormat:'
('#datepicker').datepicker({ dateFormat: 'dd/mm/yy' });


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

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