Hi friends,

could anybody guide me , how to find that a date exists in between two dates ?

For example : 23/09/2008 -- 28/09/2008 - I'am on leave.
When a attendence is entered for the date 24/09/2008 , then i should get a msg saying, that the given date exists in the leave date.

In a leave table, i already store the above two dates and save. I will enter the attendence in the front end

Recommended Answers

All 3 Replies

hi,

fetch your leave start date and end date
startdate = stdt
enddate = nddt

if currentdate >= stdt AND currentdate <= nddt
{
        msgbox (".....")
}

I did this condition but itis not working.
is there any other way to solve it

Put the date in a variable first and then compare them.

Private Sub Form1_Load(ByVal sender As System.Object, _
                           ByVal e As System.EventArgs) _
                           Handles MyBase.Load
        Dim dateFrom As Date = New Date(2008, 12, 1)
        Dim dateTo As Date = New Date(2008, 12, 5)
        Dim dateAttend As Date = New Date(2008, 12, 3)

        If dateAttend > dateFrom And dateAttend < dateTo Then
            MessageBox.Show("You're are on holiday!")
        End If
    End Sub
commented: Better +17
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.