# File.SetStamp(Text, Date [, Time]) Method
> Version: _Available or changed with runtime version 1.0._
Sets a timestamp for a file.
> NOTE
> This method is supported only in Business Central on-premises.
## Syntax
```al
[Ok := ]  File.SetStamp(Name: Text, Date: Date [, Time: Time])
```
> NOTE
> This method can be invoked without specifying the data type name.
## Parameters
Name
Type: ../text/text-data-type
The name of the file, including its path. When you enter the path, keep in mind these shortcuts:
 You can omit the drive designation, if the file is located on the current drive.
 You can omit the full path, if the file is located in the current directory.
 You can enter only the subdirectory name, if the file is located in a subdirectory of the current directory.
Date
Type: ../date/date-data-type
The date that you want stamped on the file.
*[Optional] Time*
Type: ../time/time-data-type
The time that you want stamped on the file.
## Return Value
*[Optional] Ok*
Type: ../boolean/boolean-data-type
true if the operation was successful; otherwise false. If you omit this optional return value and the operation does not execute successfully, a runtime error will occur.
## Example
The following example sets timestamp for that a file that is named varFileName. The date and time are set to the current date and on your computer respectively. The code example assumes that you have created the following file: 'C:\\MyFolder\\MyText.txt'. The following example requires that you create the following global variables and text constant.
```al
 var
    varFileName: Text;
    varDate: Date;
    varTime: Time;
    Text000: Label 'The timestamp for this file is Date: %1 Time: %2.';
begin
    VarFileName := 'C:\MyFolder\MyText.txt';
    varDate := Today;
    varTime := Time;
    SetStamp(VarFileName, varDate, varTime);
    Message(Text000, varDate, varTime);
end;
```
## Related information
file-data-type
Get Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/file/file-setstamp-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/file/file-setstamp-method/
