ASP DateCreated Property

Last Updated : 25 Mar, 2021

The ASP DateCreated Property is used to return the date and time when the given file was created on the system.

Syntax:

  • For File Object:

    FileObject.DateCreated
  • For Folder Object:

    FolderObject.DateCreated

The below examples demonstrate the ASP DateCreated Property.

Example 1: The below code demonstrates the ASP File.DateCreated Property.

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
%>

Output:

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

Example 2: The below code demonstrates the ASP Folder.DateCreated Property.

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
%>

Output:

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