| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Hi
Can anyone help me with this one. I have a global.asa file which works out the current time. Sub Application_OnStart Application("hr")=now() End Sub What I would like to do is to work out how to change a documents content - e.g. change text colour by using date difference, i.e. datediff("h",Application("hr"),now()) The following below is nearly there but not quite. Could someone help me complete the puzzle. Many thanks Miles Response.Write "<br> Current time :-" & now() Response.Write "<br> App time :-" & hr colorname="red" if hr="" then hr = now() else Response.write "<br> Difference of hours :- " & datediff("h",Application("hr"),now()) if datediff("h",Application("hr"),now()) >= 48 then colorname="yellow" end if end if Response.Write "<h1><font color="&colorname&">Hello World</font></h1>" |
|
#2
|
||||
|
||||
|
What isn't working about it?
|
|
#3
|
||||
|
||||
|
change to yellow
Thanks for the quick reply.... as always.
I can't get it to get the date from the global.asa file and if it is then it does not appear to change the text to yellow after 48 hours. Quote:
|
|
#4
|
|||
|
|||
|
now must be first parameter
hello mwoolgar ;
look at this : (not tested) Code:
if DateDiff("h",now(),Application("hr")) >= 48 then
colorname="yellow"
end if
try... |
|
#5
|
||||
|
||||
|
This is what I did to make it work:
<% Response.Write "<br> Current time :-" & now() Response.Write "<br> Current time :-" & now() Response.Write "<br> App time :-" & application("hr") colorname="red" if datediff("h",Application("hr"),now()) >= 48 then colorname="yellow" end if Response.Write "<h1><font color="&colorname&">Hello World</font></h1>" |
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > somethings missing!? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|