AxHost.GetTimeFromOADate(Double) 方法

定義

傳回 DateTime 結構,對應至指定的 OLE Automation 日期。Returns a DateTime structure that corresponds to the specified OLE Automation date.

protected:
 static DateTime GetTimeFromOADate(double date);
protected static DateTime GetTimeFromOADate (double date);
static member GetTimeFromOADate : double -> DateTime
Protected Shared Function GetTimeFromOADate (date As Double) As DateTime

參數

date
Double

要轉譯的 OLE Automate 日期。The OLE Automate date to translate.

傳回

DateTime,表示和 date 相同的日期和時間。A DateTime that represents the same date and time as date.

例外狀況

日期不是有效的 OLE Automation 日期值。The date is not a valid OLE Automation Date value.

備註

date參數為雙精確度浮點數,表示在基礎日期之前或之後的日期(1899年12月30日午夜)。The date parameter is a double-precision floating-point number that represents a date as the number of days before or after the base date, midnight, 30 December 1899. 將日期date編碼為從1899年12月30日起算的正負號和整數部分,而分數date部分的絕對值是將一天中的時間,編碼為從午夜算起的日位移。The sign and integral part of date encode the date as a positive or negative day displacement from 30 December 1899, and the absolute value of the fractional part of date encodes the time of day as a fraction of a day displacement from midnight. date必須是介於負657435.0 到正2958466.0 之間的值。date must be a value between negative 657435.0 through positive 2958466.0.

請注意,由於日期的編碼方式,在1899年12月30日的任何時間都有兩種表示方式。Note that because of the way dates are encoded, there are two ways of representing any time of day on 30 December 1899. 例如,-0.5 和0.5 兩個都表示 1899 12 月30日上午12:00,因為基底日期的午夜或減零天的時差仍然是基底日期,而從午夜算起的半天置換則是中午。For example, -0.5 and 0.5 both mean noon on 30 December 1899 because a day displacement of plus or minus zero days from the base date is still the base date, and a half day displacement from midnight is noon.

如需 OLE Automation 的詳細資訊,請參閱MSDN LibraryFor more information about OLE Automation, see the MSDN Library.

適用於