Display the Time Without the Second

80酷酷网    80kuku.com

  The built in ASP time object returns the time in the format of HH:MM:SS AM/PM (i.e., 11:10:52 AM). Often times, you don't want to show the seconds, you just want to show HH:MM AM/PM. Now it can be done!

The Code:
<%
DT = time()
Length = LEN(DT)
TheTime = LEFT(DT, Length - 6)
AMPM = RIGHT(DT, 2)
DT = TheTime + AMPM
Response.Write DT
%>

The Result:
11:10 AM











分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: