登录 | 注册 | FAQ
Anonymous

How to check validation between two date from and to date ?

+ 发表回复

4 篇帖子 分页: 1 / 1


How to check validation between two date from and to date ?

confidence123 » 周一 10月 13, 2014 5:08 am

hiee,

Please help out this problem...
头像

confidence123

  • 帖子: 7
  • 注册: 周一 10月 13, 2014 4:38 am

Re: How to check validation between two date from and to dat

XainPro » 周一 10月 13, 2014 6:47 am

explain further are you working in asp ?
头像

XainPro

  • 帖子: 3933
  • 注册: 周五 2月 17, 2012 8:10 pm

Re: How to check validation between two date from and to dat

confidence123 » 周三 10月 22, 2014 5:46 am

Use this code

string fromdate = txtFromDate.Text;
string[] ayy1 = fromdate.Split(' ');
string date2 = ayy1[0];
string todate1 = txtToDate.Text;
string[] ayy2 = todate1.Split(' ');
string todate2 = ayy2[0];
头像

confidence123

  • 帖子: 7
  • 注册: 周一 10月 13, 2014 4:38 am

Re: How to check validation between two date from and to dat

Farhin Qureshi » 周一 1月 23, 2017 11:07 am

Hi,

You can try this code to check two date.

代码: 全选
List<DateTime> list = new List<DateTime> { Convert.ToDateTime("02/11/2011"), Convert.ToDateTime("25/12/2011"), Convert.ToDateTime("09/12/2011"), Convert.ToDateTime("13/12/2011") };


        foreach(var date in list)
        {
            if ((date.CompareTo(Convert.ToDateTime("01/11/2011")) > 0) && (date.CompareTo(Convert.ToDateTime("15/12/2011")) < 1))
            {
                //return value
                break;
            }

        }


Thanks.
头像

Farhin Qureshi

  • 帖子: 45
  • 注册: 周二 1月 03, 2017 11:33 am
--
Farhin Qureshi
.NET Developer
http://www.ifourtechnolab.com


+ 发表回复

分页: 1 / 1