FileSystemInfo.CreationTimeUtc 屬性

定義

取得或設定目前檔案或目錄的建立時間,其格式為國際標準時間 (Coordinated Universal Time,UTC)。

public:
 property DateTime CreationTimeUtc { DateTime get(); void set(DateTime value); };
public DateTime CreationTimeUtc { get; set; }
[System.Runtime.InteropServices.ComVisible(false)]
public DateTime CreationTimeUtc { get; set; }
member this.CreationTimeUtc : DateTime with get, set
[<System.Runtime.InteropServices.ComVisible(false)>]
member this.CreationTimeUtc : DateTime with get, set
Public Property CreationTimeUtc As DateTime

屬性值

目前 FileSystemInfo 物件以 UTC 格式表示的建立日期和時間。

屬性

例外狀況

Refresh() 無法初始化資料。

指定的路徑無效;例如,位於未對應的磁碟上。

目前的作業系統不是 Windows NT 或更新版本。

呼叫端嘗試設定無效的建立時間。

備註

注意

這個方法可能會傳回不正確的值,因為它會使用操作系統可能不會持續更新其值的原生函式。

如果物件的目前實例FileSystemInfo從下列DirectoryInfo任一方法傳回,則會預先快取 屬性的值CreationTimeUtc

若要取得最新的值,請呼叫 Refresh 方法。

如果物件中所述的 FileSystemInfo 檔案不存在,則此屬性會傳回 12:00 午夜,1601 A.D. (C.E.) 國際標準時間 (UTC) 。

在不支援建立或出生日期的 Unix 平臺上,這個屬性會傳回上次狀態變更的較舊時間,以及上次修改的時間。 在其他平臺上,它會傳回上午 12:00,1601 A.D. (C.E.) 國際標準時間 (UTC) ,調整為當地時間。

NTFS 格式的磁碟驅動器可能會快取檔案中繼資訊,例如檔案建立時間短時間。 此程序稱為檔案通道。 因此,如果您要覆寫或取代現有的檔案,可能需要明確設定檔案的建立時間。

適用於

另請參閱