FileDate$

File management function.

The FileDate$ function returns the modification date of the specified file.

Syntax

var$=FileDate$(<filename>)

Parameters

<filename>, string, name of the file.

Return value

var$, string, modification date (format dd/mm/yyyy). If <filename> is empty or the file does not exist, an empty string is returned. To transform the date format in a US format (mm/dd/yyyy), see example code below.

Example

 

a$=FileDate$("myfile.txt")

Example code

Date$() returns a date with the format specified in Windows.
Filedate$() returns the file creation date always with format dd/mm/yyyy.
The two next functions transform from one format to the other

'************************************************************

 

'Conversion of file creation date to format mm/dd/yyyy

'ARGUMENT of this function is the name of the file

 

function american_filedate_date$(file$)

local da$, mon$, yea$, date_file$

 

date_file$=filedate$(file$)

da$=left$(date_file$,2)

mon$=mid$(date_file$,4,2)

yea$=right$(date_file$,4)

american_filedate_date$=mon$+"/"+da$+"/"+yea$

endfunction

 

'-------------------------------------------------------------------

'Function which gives always the current date at format dd/mm/yyyy

 

function european_date$()

local da$, mon$, yea$, date_file$

da$=day$()

mon$=month$()

yea$=year$()

european_date$=da$+"/"+mon$+"/"+yea$

endfunction

 

'-------------------------------------------------------------------------

 

'Example

 

mes$="Current date at format dd/mm/yyyy is : "+european_date$()

msgbox(mes$)

 

create("c:\bidon.txt")

mes$="File date created today at format mm/dd/yyyy is : "+american_filedate_date$("c:\bidon.txt")

msgbox(mes$)