Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2003
    Posts
    32

    Question Unanswered: problem comparing date value with multiple condition

    any idea how to compare two date. because i want make mulitple i condition to solve my problem

    here what i want to do:

    list data on asp page with multiple condition for displaying day late:

    Condition:

    1. Check if delivery date(store as sting in table) -> Isdate True or False
    2. If True then check delivery status.false then exit
    3. if delivery status = 0 then check delivery date > current date else exit
    4. if delivery date > current date then exit else count day late

    right now i can't compare for condition no.3 (cause if i not compare this then the result will count day late before and after promised date) . which i expected only day late return after promised date only.

    here my code:

    ord_PromisedDate = rstOrders("ord_PromisedDate")
    stat_deli = cint(rstOrders("stat_deli"))

    stat_prodates = IsDate(ord_PromisedDate)
    convert_prodate = fncfmtdate(rstOrders("ord_PromisedDate"),"%d/%M/%Y")

    NOWDATE= fncfmtdate(Date,"%d/%M/%Y")

    if stat_deli = 0 then
    curr_stat = "No Delivery"
    else if stat_deli = 1 then
    curr_stat = "Complete Delivery"
    else if stat_deli = 2 then
    curr_stat = "Partial Delivery"
    end if
    end if
    end if

    if stat_prodates = true AND stat_deli = 0 then
    day_late = DateDiff ("d",convert_prodate,NOWDATE)
    else if stat_prodates = False then
    day_late = ""
    end if
    end if

    ANY HELP OR SOLUTION REALLY APPRECIATED.

    thank you.

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Do you mean:

    if stat_prodates = true AND stat_deli = 0 then
    daylate = DateDiff ("d",convert_prodate,NOWDATE)
    if daylate <= 0 then
    day_late = ""
    end if
    else if stat_prodates = False then
    day_late = ""
    end if
    end if

    You can also subtract the NOWDATE from convert_prodate - if that value is greater than 0 then day_late.

    Also, this might be better handled by the database. Do you want to even show records that are not late ?

Posting Permissions

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