Dim Dt As DateTime
Try
Dt = GetValueFromDB("select joindate from employee where emp_id='" & TextBox1.Text & "'")
if monthDifference(Dt,system.DateTime.Date) > 6 then
End if
Public Function monthDifference(ByVal startDate As DateTime, ByVal endDate As DateTime) As Integer
Dim t As TimeSpan = endDate - startDate
Dim difference As Integer = t.Days
Dim months As Integer = Math.Floor(difference / 30.475)
Return months
End Function
where
GetValueFromDB is some function that takes input Query and gives Output value (all sql functionality are handled inside) ,
and
monthDifference is function that will return difference in months when we input two dates as parameter
Happy coding!
:)