Login | Register | FAQ
Anonymous

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

+ Post a reply

4 posts Page 1 of 1


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

by confidence123 » Mon Oct 13, 2014 5:08 am

hiee,

Please help out this problem...
User avatar

confidence123

  • Posts: 7
  • Joined: Mon Oct 13, 2014 4:38 am

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

by XainPro » Mon Oct 13, 2014 6:47 am

explain further are you working in asp ?
User avatar

XainPro

  • Posts: 3933
  • Joined: Fri Feb 17, 2012 8:10 pm

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

by confidence123 » Wed Oct 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];
User avatar

confidence123

  • Posts: 7
  • Joined: Mon Oct 13, 2014 4:38 am

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

by Farhin Qureshi » Mon Jan 23, 2017 11:07 am

Hi,

You can try this code to check two date.

Code: Select all
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.
User avatar

Farhin Qureshi

  • Posts: 45
  • Joined: Tue Jan 03, 2017 11:33 am
--
Farhin Qureshi
.NET Developer
http://www.ifourtechnolab.com


+ Post a reply

Page 1 of 1