如何给出dd/mm/yyyy格式 [英] how to give a dd/mm/yyyy format

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

问题描述

我想在文本框中显示日期,但不使用日历.最终用户应以dd/mm/yyyy格式输入数字,但我的要求是月份不能超过13,日期不能超过31.


我是asp.net
的新手 如果不清楚,请给我答复.

I want to display the date in textbox but with out using calendar. The end user should enter the numbers in dd/mm/yyyy format but my requriment is the month should not be above 13 and the date above 31.


I am new to asp.net and
if the question is not clear please reply me back.

推荐答案

只需使用DateTime.TryParse()方法验证日期.如果日期无效,它将不解析日期,并且将返回false指示失败.
Just use the DateTime.TryParse() method to validate the date. It will not parse the date if it''s invalid, and will return false indicating the failure.


看看TryParse方法.
HTH
Take a look at the TryParse method.
HTH


MaskedEdit [

这篇关于如何给出dd/mm/yyyy格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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