ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / External file functions
  • Example 1: Retrieving the different dates and times associated with a file
  • Example 2: Modifying the creation date of a file
fDateTime (Example)
Example 1: Retrieving the different dates and times associated with a file
Reports and Queries The following code is used to find out the different dates and times associated with a file.
// Declare the variables
ResDateTimeCreation is string
ResDateTimeModification is string
ResDateTimeAccess is string
FilePath is string
// Select a file
FilePath = "C:\MyDirectories\File.txt"
// Retrieve the file date information
ResDateTimeCreation = fDateTime(FilePath, "", fCreation)
ResDateTimeModification = fDateTime(FilePath, "", fModification)
ResDateTimeAccess fDateTime(FilePath, "", fAccess)
IF ResDateTimeCreation <> "" AND ResDateTimeModification <> "" AND ResDateTimeAccess <> "" THEN
// Display the different dates and times associated with a file
Info("The creation date and time are: " + ResDateTimeCreation + CR + ...
"The modification date and time are: " + ResDateTimeModification + CR + ...
"The access date and time are: "+ ResDateTimeAccess)
ELSE
// Display an error message if the retrieval was not performed
Error(ErrorInfo(errMessage))
END
Example 2: Modifying the creation date of a file
Reports and Queries The following code is used to modify the creation date of a file by the system date of the computer.
// Declare the variables
ResDateTimeCreation is string
ResDateTimeSystem is string
FileTimePath is string
// Select a file
FilePath = "C:\MyDirectories\File.txt"
// Retrieve the system date and time
ResDateTimeSystem = DateSys() + TimeSys()
// Modify the creation date of the selected file
ResDateTimeCreation = fDateTime(FilePath, ResDateTimeSystem, fCreation)
IF ResDateTimeCreation <> "" THEN
// Display the creation date
Info("The creation date and time are now: " + ResDateTimeCreation)
ELSE
// Display an error message if the retrieval was not performed
Error(ErrorInfo(errMessage))
END
Minimum version required
  • Version 10
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 08/22/2022

Send a report | Local help