time.asp

来自「用ASP语言开发的一个不错的留言本。 升级时注册先只上传upgrade.asp」· ASP 代码 · 共 56 行

ASP
56
字号
<%
function times(t)
	if not isdate(t) then exit function
	dim thour, tminute, tday, nowday, dnt, dayshow, pshow
	thour=hour(t)
	tminute=minute(t)
	tday=datevalue(t)
	nowday=datevalue(dateadd("h",timeDiff,now))
	
	if thour<10 then
		thour="0"&thour
	end if
	if tminute<10 then
		tminute="0"&tminute
	end if
	
	dnt=datediff("d",tday,nowday)
	if dnt>2 then
	   dayshow=year(t)
	   if (month(t)<10) then
	   	dayshow=dayshow&"-0"&month(t)
	   else
	   	dayshow=dayshow&"-"&month(t)
	   end if
	   if (day(t)<10) then
	   	dayshow=dayshow&"-0"&day(t)
	   else
	   	dayshow=dayshow&"-"&day(t)
	   end if
	   times=dayshow
	   exit function
	elseif dnt=0 then
	   dayshow="今天 "
	elseif dnt=1 then
	   dayshow="昨天 "
	elseif dnt=2 then
	   dayshow="前天 "
	end if
	
	'if thour>=7 and thour<11 then
	'   pshow="上午"
	'elseif thour>=11 and thour<14 then
	'   pshow="中午"
	'elseif thour>=14 and thour<18 then
	'  pshow="下午"
	'elseif thour>=18 then
	'   pshow="晚上"
	'elseif thour>=0 and thour<7 then
	'  pshow="清晨"
	'else
	'  pshow="难说"
	'end if
	
	times=dayshow&pshow&thour&":"&tminute
end function
%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?