hai

i want to know that how to compare the two srting's ... i mean i have a date in string 1 and in the second string i have other date
now i want to compare by operant <,>, i convert that string to int but it through error

Hi there
Check it out this sample code in vb

Private Function compareDate() As String
        Dim d1 As String = "01/01/2009"
        Dim d2 As String = "01/02/2009"
        Dim strmessage As String
        If CType(d1, Date) > CType(d2, Date) Then
            Return strmessage = "greater"
        ElseIf CType(d1, Date) < CType(d2, Date) Then
            Return strmessage = "Lesser"
        End If
    End Function

Mark as solved if it helps you!!!

In C#:

DateTime time1 = DateTime.Parse("09/11/2000");
DateTime time2 = DateTime.Parse("09/12/2000");

if(time1 > time2) {...}
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.