📜  ASP DateCreated 属性

📅  最后修改于: 2022-05-13 01:56:54.378000             🧑  作者: Mango

ASP DateCreated 属性

ASP DateCreated 属性用于返回给定文件在系统上创建的日期和时间。

句法:

  • 对于文件对象:

    FileObject.DateCreated
  • 对于文件夹对象:

    FolderObject.DateCreated

下面的示例演示了ASP DateCreated 属性

示例 1:下面的代码演示了 ASP File.DateCreated 属性。

ASP
<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
  
'Getting the file
set f=fs.GetFile("d:\GFG.txt")
Response.Write("File created on: ")
  
'Getting the date that the file was created
Response.Write(f.DateCreated)
set f=nothing
set fs=nothing
%>


ASP
<%
dim fs,fol
set fs=Server.CreateObject("Scripting.FileSystemObject")
  
'Getting the folder
set fol=fs.GetFolder("d:\GFG")
Response.Write("This folder was created on: ")
  
'Getting the date when the folder was created
Response.Write(fol.DateCreated)
  
set fol=nothing
set fs=nothing
%>


输出:

File created on: 3/4/2020 10:07:20 AM

示例 2:下面的代码演示了 ASP Folder.DateCreated 属性。

ASP

<%
dim fs,fol
set fs=Server.CreateObject("Scripting.FileSystemObject")
  
'Getting the folder
set fol=fs.GetFolder("d:\GFG")
Response.Write("This folder was created on: ")
  
'Getting the date when the folder was created
Response.Write(fol.DateCreated)
  
set fol=nothing
set fs=nothing
%>

输出:

This folder was created on: 12-03-2021 12:54:29