Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    202

    Unanswered: Difference between 2 date

    Hi there,

    i need to key in a date into to text box which look like below

    From ________ To_______ : "_________" = text box

    then of course the first text box cant be the date greater than the second one rite.
    so how do i determine it in asp form?
    Thanx

  2. #2
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    Use DateDiff()

    Code:
    If DateDiff("d", StartDate, EndDate) < 0 Then
      'End date is before the start date - show error
    Else
      'Start date is before the end date (or the same day) - continue processing
    End If
    That which does not kill me postpones the inevitable.

  3. #3
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    you could probably also try....
    Code:
    If CDate(StartDate) > CDate(EndDate) Then
      'End date is before the start date - show error
    Else
      'Start date is before the end date (or the same day) - continue processing
    End If

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •