語言

GregorianCalendar.ToDateTime 方法

定義

回傳設定為指定時代的日期與時間的 a DateTime 。

public:
 override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era);
public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era);
override this.ToDateTime : int * int * int * int * int * int * int * int -> DateTime
Public Overrides Function ToDateTime (year As Integer, month As Integer, day As Integer, hour As Integer, minute As Integer, second As Integer, millisecond As Integer, era As Integer) As DateTime

參數

year
Int32

一個整數代表年份。

month
Int32

一個從1到12的整數,代表月份。

day
Int32

一個從1到31的整數代表這一天。

hour
Int32

一個從0到23的整數,代表小時。

minute
Int32

一個從0到59的整數,代表分鐘。

second
Int32

一個從0到59的整數,代表秒。

millisecond
Int32

一個從0到999的整數,代表毫秒。

era
Int32

一個整數代表那個時代。

傳回

DateTime那個設定在當前時代指定的日期和時間。

例外狀況

era 超出日曆所支持的範圍。

-或-

year 超出日曆所支持的範圍。

-或-

month 超出日曆所支持的範圍。

-或-

day 超出日曆所支持的範圍。

-或-

hour 小於零或大於23。

-或-

minute 小於零或大於59。

-或-

second 小於零或大於59。

-或-

millisecond 小於零或大於999。

適用於

另請參閱