GetFileTime
- Last UpdatedOct 29, 2026
- 2 minute read
GetFileTime is a built-in function that gets the date and time that a file was last modified.
|
Function |
Group |
Execution |
String Exp. |
Windows |
Windows Embedded |
IoT View |
Thin Clients |
Mobile Access |
|---|---|---|---|---|---|---|---|---|
|
GetFileTime |
File |
Synchronous |
Yes |
Supported |
Supported |
Supported |
Executed on Server (see Notes below) |
Supported |
Syntax
GetFileTime(strFileName,optNumFormat)
strFileName
The file path and name of the file to be read.
Note: Follow the conventions of the target platform for the file path and name, and separators. For example, a file path in Windows starts with a drive letter and uses backward slashes as separators (C:\path\to\file), while a file path in Linux starts at the root directory and uses forward slashes as separators (/path/to/file).
optNumFormat
A numeric flag specifying the format of the returned data:
|
Value |
Description |
|---|---|
|
0 |
Date and time (that is, MM/DD/YYYY HH:MM:SS). |
|
1 |
Date only (that is, MM/DD/YYYY). |
|
2 |
Time only (that is, HH:MM:SS). |
This parameter is optional; if no value is specified, the default value is 0.
Returned value
This function returns the date and/or time that the file was last modified. The date will be formatted according to the current date format; for more information, see About the date format and how to change it. The time will be formatted as HH:MM:SS.
Notes
By default, this function is executed on the project runtime server even when it is called in a screen on a project thin client, which means it only affects directories and files that are located on the server and all paths must be specified in that context. You can change the default behavior to force this function to be executed on the client where it is called, but if you do so, you must keep in mind that the change will affect not just this function but also several other File functions. To change the behavior of these functions, use a text editor to open your project file (<project name>.app) and then edit the following property:
[Options]
ExecuteFileFunctionsOnClient=1
Examples
Get the date and time that the file Readme.txt was last modified:
GetFileTime("C:\Readme.txt")
Get the date only that the file History.txt was last modified:
GetFileTime("C:\History.txt",1)