Click to See Complete Forum and Search --> : Timetable
icemonkey
06-10-2006, 07:34 PM
Hi all,
If you can i would appreciate the help alot if not dont worry:
i am currently looking for a script that will show text at the time i state in a database or text file or anything, example
6am it will say frog
7am it will say dynamic
8.15 it will say decrease
and so on,
i would prefer this to be in asp format but all others are welcome
Thanks alot
icemonkey
06-10-2006, 07:35 PM
or even if you could give me a link to a couple of pages or old threads that would be brilliant
russell
06-10-2006, 07:55 PM
this ought to give u a start
Dim hr
Dim greeting
hr = DatePart("h", now())
Select Case hr
Case 0
greeting = "It's past midnight"
Case 1
greeting = "Goooood Morning"
Case 2
greeting = "It's after 2 AM!"
.....
Case 13 '' 1pm
greeting = "Good Afternoon"
.....
End Select
Response.Write greeting
icemonkey
06-11-2006, 05:58 AM
brilliant, how would i get it to do say half past and ten past or, really everything in between 0 and 59
russell
06-11-2006, 12:23 PM
lot's of ways. this is probably easiest
Dim timeOfDay
Dim greeting
timeOfDay = timevalue(now())
Select Case true
Case timeOfDay > timevalue("00:00") and timeOfDay < timevalue("4:31")
greeting = "You're up pretty late!"
Case timeOfDay > timevalue("4:30") and timeOfDay < timevalue("7:15")
greeting = "Good Morning"
Case timeOfDay > timevalue("7:14") and timeOfDay < timevalue("9:15")
greeting = "Time for work"
Case timeOfDay > timevalue("9:14") and timeOfDay < timevalue("11:52")
greeting = "blah blah blah"
Case timeOfDay > timevalue("11:51") and timeOfDay < timevalue("12:37")
greeting = "Let's grab some lunch"
Case Else
greeting = "Hello World"
End Select
Response.Write greeting & " " & timeOfDay