DateAndTime.Second(DateTime) 方法
定义
返回表示一分钟内第几秒的整数值,该值介于 0 和 59 之间。Returns an integer value from 0 through 59 representing the second of the minute.
public:
static int Second(DateTime TimeValue);
public static int Second (DateTime TimeValue);
static member Second : DateTime -> int
Public Function Second (TimeValue As DateTime) As Integer
参数
- TimeValue
- DateTime
必需。Required. 要从中提取秒的 Date 值。A Date value from which you want to extract the second.
返回
介于 0 和 59 之间表示一分钟内第几秒的整数值。An integer value from 0 through 59 representing the second of the minute.
示例
下面的示例使用 Second 函数从指定的时间获取分钟的秒数。The following example uses the Second function to obtain the second of the minute from a specified time. 在开发环境中,使用代码的区域设置以短时间格式显示时间。In the development environment, the time literal is displayed in short time format using the locale settings of your code.
Dim thisTime As Date
Dim thisSecond As Integer
thisTime = #4:35:17 PM#
thisSecond = Second(thisTime)
' thisSecond now contains 17.
注解
还可以通过调用 DatePart 并为参数指定来获取分钟的秒数 DateInterval.Second Interval 。You can also obtain the second of the minute by calling DatePart and specifying DateInterval.Second for the Interval argument.