If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > problem comparing date value with multiple condition

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-18-03, 01:57
zakyk zakyk is offline
Registered User
 
Join Date: Mar 2003
Posts: 32
Question 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.
Reply With Quote
  #2 (permalink)  
Old 12-19-03, 00:47
rnealejr rnealejr is offline
Registered User
 
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 ?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On