Second 関数 (Visual Basic)

更新 : 2007 年 11 月

秒を表す 0 ~ 59 の整数型 (Integer) の値を返します。

Public Function Second(ByVal TimeValue As DateTime) As Integer

パラメータ

  • TimeValue
    必ず指定します。秒を抽出する日付型 (Date) の値です。

解説

DatePart を呼び出し、Interval 引数に DateInterval.Second を指定することによっても秒を取得できます。

使用例

次の例は、Second 関数を使って、指定された時刻の秒を取得します。開発環境では、時刻リテラルは、コード記述時のロケールで設定されている短い形式で表示されます。

Dim thisTime As Date
Dim thisSecond As Integer
thisTime = #4:35:17 PM#
thisSecond = Second(thisTime)
' thisSecond now contains 17.

必要条件

名前空間 : Microsoft.VisualBasic

**モジュール :**DateAndTime

**アセンブリ :**Visual Basic ランタイム ライブラリ (Microsoft.VisualBasic.dll)

参照

参照

Day 関数 (Visual Basic)

Hour 関数 (Visual Basic)

Minute 関数

Now プロパティ

TimeOfDay プロパティ

DatePart 関数 (Visual Basic)

System

DateTime

ArgumentException

ArgumentOutOfRangeException