[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!
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
%>
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
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
%>