FolderItem.CreationDate

From Xojo Documentation

Property (As Date )
aFolderItem.CreationDate = newDateValue
or
DateValue = aFolderItem.CreationDate

Supported for all project types and targets.

The creation date of the FolderItem.

Notes

Do not modify the CreationDate directly. Instead always assign a new Date instance to it. Refer to the example below.

On Windows, the CreationDate cannot be changed if the file is open. This includes if it is open using a BinaryStream, TextInputStream or TextOutputStream. Close the file before changing the CreationDate.

On Linux, the CreationDate cannot be modified. Attempting to change it raises an UnsupportedOperationException. Also, the CreationDate may not be accurate as many Linux file systems do NOT actually track the creation date.

Example

This example displays the creation date in the ShortDate format.

Dim f As New FolderItem
MsgBox(f.CreationDate.ShortDate)

Changing CreationDate is slightly more complex. You cannot just change the CreationDate property directly because you will simply be changing a date that is not persistent. Instead you need to create a new date instance with the date you want and then assign that to CreationDate. Here is an example that sets a file's creation date to the current date and time:

Dim f As New FolderItem
f = GetOpenFolderItem("")

If f <> Nil Then
Dim newDate As New Date
f.CreationDate = newDate
End If