FILEDATETIME

Action

Returns the file date and time of a file

 

Syntax

Var = FileDateTime ()

Var = FileDateTime (file)

 

Remarks

Var

A string variable or byte array that is assigned with the file datge and time of the specified file

File

The name of the file to get the date time of.

 

When the target variable is a string, it must be dimensioned with a length of at least 17 bytes.

When the target variable is a byte array, the array size must be at least 6 bytes.

 

When you use a numeric variable, the internal file date and time format will be used.

 

ASM

Calls

_FileDateTimeS

_FileDateTimeS0

Input

 

 

Output

 

 

 

Calls

_FileDateTimeB

_FileDateTimeB0

Input

 

 

Output

 

 

 

Example(partial)

' Read and print Directory and show Filename, Date, Time, Size
' for all files matching pStr1 and create/update younger than pDays
Sub Directorylist(pstr1 As String , Byval Pdays As Word)
Local lFileName as String * 12 ' hold file name for print
Local lwCounter as Word , lFileSizeSum as Long ' for summary
Local lwNow as Word , lwDays as Word
Local lSec as Byte , lMin as Byte , lHour as byte , lDay as byte , lMonth as byte , lYear as byte
print "Listing of all Files matching " ; pStr1 ; " and create/last update date within " ; pdays ; " days"
lwNow = SysDay()
lwCounter = 0 : lFileSizeSum = 0
lFileName = Dir(pStr1)
While lFileName <> ""
lsec = FileDateTime()
lwDays = lwNow - SysDay(lDay) ' Days between Now and last File Update; uses lDay, lMonth, lYear
if lwDays <= pDays then ' days smaller than desired with parameter
print lFileName ; FileDate() ; " " ; FileTime() ; " " ; filelen()
incr lwCounter : lFileSizeSum = FileLen() + lFileSizeSum
end if
lFileName = Dir()
WEnd
print lwCounter ; " File(s) found with " ; lFileSizeSum ; " Byte(s)"
End Sub