This topic is locked

Time color coding

9/27/2007 1:36:32 PM
ASPRunnerPro General questions
M
mfred author

Some time ago you assited me with code for having the line items in a list change color based on the proximity to a due date and time. The code is based at the end of this message and it has worked well with several projects. THe difference with one project is that it needs to display world time (0001-2400) instead of AM/PM. I have the system created but was unable to adapt the code for the difference time scheme. Any help is appreciated. Although I have 5.1, this particular client app is being done in 4.0.

Sergey Kornilov admin 9/27/2007

Where is the code?

M
mfred author 10/1/2007

Sorry, Here is the code that I use for AM/PM:
Replace:
' To insure that every other one is shaded

If iShadeTheDetail = 0 then

sShadeClass = "class=shade"

iShadeTheDetail = 1

Else

sShadeClass = ""

iShadeTheDetail = 0

End If
with
' To ensure that every other one is shaded

If iShadeTheDetail = 0 then

sShadeClass = "class=shade"

iShadeTheDetail = 1

Else

sShadeClass = ""

iShadeTheDetail = 0

End If
if rs("Status")<>"Done" then

' calculate due datetime

due_date=rs("Due_Date")

due_time=trim(rs("Due_Time"))

if due_time<>"" then

due_pm=false

if left(due_time,2)="PM" then due_pm=true

due_time=trim(mid(due_time,3))

due_pos = instr(due_time,":")

due_min=0

if due_pos>0 then

due_hour=CInt(left(due_time,due_pos-1))

due_min=CInt(mid(due_time,due_pos+1))

else

due_hour=CInt(due_time)

end if

if due_pm then

if due_hour<12 then due_hour=due_hour+12

else

if due_hour=12 then due_hour=0

end if

due_date=dateadd("h",due_hour,due_date)

due_date=dateadd("n",due_min,due_date)

end if

' highlight records

if datediff("n",now(),due_date)<0 then

sShadeClass = "style=""background-color:pink"""

elseif datediff("n",now(),due_date)<60 then

sShadeClass = "style=""background-color:yellow"""

elseif datediff("n",now(),due_date)<120 then

sShadeClass = "style=""background-color:lightgreen"""

end if

end if

M
mfred author 10/4/2007

I just wanted to follow-up on this.

Sergey Kornilov admin 10/5/2007

Sorry, have no idea what this code does.