比较验证 [英] Compare validate

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

问题描述


我有Date from(mm/dd/yyyy)和Date To(mm/dd/yyyy).
日期来自:分别为MM,DD和YYYY的3个文本框
日期:分别为MM,DD和YYYY的3个文本框
谁能帮助我如何比较验证这两个日期?任何人都可以为其提供代码.

谢谢
Krish

Hi
I have Date from (mm/dd/yyyy) and Date To (mm/dd/yyyy).
Date from: 3 textboxes for MM, DD, YYYY respectively
Date to : 3 textboxes for MM, DD, YYYY respectively
Can anyone help me how to compare validate these two dates? Can anybody please provide code to it.

Thank You,
Krish

推荐答案

您甚至还查看过C#中的DateTime类吗?

构造函数之一是:

Have you even looked at the DateTime class in C#?

One of the constructors is:

public DateTime(
    int year,
    int month,
    int day
)



因此,创建两个DateTime并进行比较,但是您将要对其进行比较.您可以使用DateTime.CompareTo(DateTime).

这是非常简单的内容,下一次我建议从谷歌搜索比较C#中的日期"开始.



So, create two DateTimes and compare them however you''re going to compare them. You can use DateTime.CompareTo(DateTime).

This is pretty simple stuff and next time I would suggest starting by googling "compare to Dates in C#".


为什么不能使用日期控件.如果要坚持使用文本框,则从所有文本框中获取日期,并使用各种IF条件进行比较... :-D
Why can''t you use date control. If you want to stick to text boxes then take the date from all the text boxes and use various IF conditions to compare them... :-D


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

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