编写ASP程序:要求根据系统时间来判断是上午、中午、下午、还是晚上。

2025-03-04 15:20:57
推荐回答(2个)
回答1:

<%
thetime=hour(time)
if thetime>=6 and thetime=<11 then
response.write("早上")
end if

if thetime=>12 and thetime=<13 then
response.write("中午")
end if

if thetime=>14 and thetime=<18 then
response.write("下午")
end if

if thetime=>19 and thetime=<23 then
response.write("晚上")
end if

if thetime=>0 and thetime=<5 then
response.write("凌晨")
end if

%>

回答2:

siptem 的回答并不是根据系统时间,而是服务器的时间。如果时间设置不正确或者非同一时区的用户就会不正常。