日期時間格式化函數 jdsj
Function jdsj()
Dim n, y, r, h, f
n = CStr(Right(Year(Date()), 2)) & "-"
y = CStr(Month(Date())) & "-"
If Len(y) = 2 Then y = "0" & y
r = CStr(Day(Date()))
If Len(r) = 1 Then r = "0" & r
h = CStr(Hour(Now())) & "-"
If Len(h) = 2 Then h = "0" & h
f = CStr(Minute(Now()))
If Len(f) = 1 Then f = "0" & f
jdsj = n & y & r & " " & h & f
End Function
中文日期顯示
xxsj = CStr(Year(Date())) & "年" & CStr(Month(Date())) & "月" & CStr(Day(Date())) & "日 " & WeekdayName(Weekday(Now))
問候語函數 WHY
Function WHY()
Dim mytime : mytime = Hour(Now())
If mytime >= 5 And mytime < 9 Then WHY = "早上好!"
If mytime >= 9 And mytime < 11 Then WHY = "上午好!"
If mytime >= 11 And mytime < 13 Then WHY = "中午好!"
If mytime >= 13 And mytime < 18 Then WHY = "下午好!"
If mytime >= 18 And mytime < 24 Then WHY = "晚上好!"
If mytime >= 0 And mytime < 5 Then WHY = "挺晚了,注意休息啊!"
End Function
使用範例
<%
Response.Write WHY() & "
"
Response.Write "現在時間:" & jdsj() & "
"
Response.Write xxsj
%>