|
-
Sep 11th, 2007, 07:04 AM
#1
Thread Starter
Addicted Member
[RESOLVED] Simple newbie ASP question
Hi,
I could do this very easily with .NET, but my client wants it in basic ASP which I have no experience of.
I hope someone can help.
If the time is between 00:00 and 11:59 then write "Good Morning"
ElseIf the time is between 12:00 and 18:00 then write "Good Afternoon"
ElseIf the time is between 18:01 and 23:59 then write "Good Evening"
Thanks!
-
Sep 11th, 2007, 09:10 AM
#2
Re: Simple newbie ASP question
Something like this should work
Code:
<%
Dim dteTime
dteTime = time
If dteTime > #18:00:00# Then
Response.Write("Good Evening")
ElseIf dteTime > #12:00:00# Then
Response.Write("Good Afternoon")
Else
Response.Write("Good Morning")
End If
%>
-
Sep 11th, 2007, 10:53 AM
#3
Thread Starter
Addicted Member
Re: Simple newbie ASP question
Is it possible to get the output into a function, so for example I could use
<%=timeOfDay%>, Welcome to our site!
<%Private Function timeOfDay as String
Dim dteTime
dteTime = time
If dteTime > #18:00:00# Then
Return "Good Evening"
ElseIf dteTime > #12:00:00# Then
Return "Good Afternoon"
Else
Return "Good Morning"
End If
%>
Have I got the syntax correct?
Thanks
-
Sep 11th, 2007, 12:02 PM
#4
Re: Simple newbie ASP question
Code:
<%=timeOfDay%>, Welcome to our site!
<%
Function timeOfDay()
Dim dteTime
dteTime = time
If dteTime > #18:00:00# Then
timeOfDay = "Good Evening"
ElseIf dteTime > #12:00:00# Then
timeOfDay = "Good Afternoon"
Else
timeOfDay = "Good Morning"
End If
End Function
%>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|