VBScript Second Function

Definition and Usage

The Second function can return a number representing the seconds of the minute, between 0 and 59.

Syntax

Second(time)
Parameter Description
time Required. Any expression that can represent time.

Instance

Example 1

D = #1/15/2002 10:55:51 AM#
document.write(Second(D))

Output:

51

Example 2

T = #10:55:51 AM#
document.write(Second(T))

Output:

51

Example 3

This example is an ASP function that can output Chinese formatted time, which uses VBScript's Hour, Minute, and Second functions.

<%
Sub HHMMSS(T)
H = Hour(T)
If H<12 then
  Response.Write "上午"&H&"时"
Else
  Response.Write "下午"&(H-12)&"时"
End If
Response.Write Minute(T)&"分"
Response.Write Second(T)&"秒"
End Sub
%>