验证日期的字符串变量 [英] validating string variable for date

查看:77
本文介绍了验证日期的字符串变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有如下字符串变量.

字符串date ="33/22/2011"(mm/dd/yyyy)

我想验证日期变量是否为正确的日期.

问候,
Nagaraju

Hi

I have string variable as below.

string date="33/22/2011" (mm/dd/yyyy)

i want to validate whether date variable is correct date or not.

Regards,
Nagaraju

推荐答案

以下是示例:

Here is the example:

DateTime someDateTime;
var dateTimeString = "99/23/56";
var isValid = DateTime.TryParse(dateTimeString, out someDateTime);



投票决定我的答案是否对您有帮助.



Vote if my answer will help you.


这篇关于验证日期的字符串变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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