0

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

3
Contributors
3
Replies
6
Views
8 Years
Discussion Span
Last Post by NEo4
0

hi,

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

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

Edited by pyTony: fixed formatting

0

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

1

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
Votes + Comments
Better
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.