Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old September 13th, 2004, 11:00 AM
mwoolgar's Avatar
mwoolgar mwoolgar is offline
e-Marketing By Design
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Location: London, UK
Posts: 141 mwoolgar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 12 h 6 m 8 sec
Reputation Power: 5
Exclamation somethings missing!?

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>"

Reply With Quote
  #2  
Old September 13th, 2004, 11:02 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
Click here for more information.
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,781 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 8 h 45 m 55 sec
Reputation Power: 470
What isn't working about it?

Reply With Quote
  #3  
Old September 13th, 2004, 11:26 AM
mwoolgar's Avatar
mwoolgar mwoolgar is offline
e-Marketing By Design
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Location: London, UK
Posts: 141 mwoolgar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 12 h 6 m 8 sec
Reputation Power: 5
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:
Originally Posted by Memnoch
What isn't working about it?

Reply With Quote
  #4  
Old September 13th, 2004, 12:46 PM
catdogfight catdogfight is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Location: istanbul
Posts: 15 catdogfight User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 28 m 50 sec
Reputation Power: 0
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...

Reply With Quote
  #5  
Old September 15th, 2004, 03:14 AM
mwoolgar's Avatar
mwoolgar mwoolgar is offline
e-Marketing By Design
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Location: London, UK
Posts: 141 mwoolgar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 12 h 6 m 8 sec
Reputation Power: 5
Thumbs up got it!

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>"

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > somethings missing!?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT