How to Change The Timestamp and Date on a File in Windows

29 August 2022

Home » Blogs » Windows » Tips and Tricks » How to Change The Timestamp and Date on a File in Windows

Using , you can change the creation date and time, the date and time last modified, and the date and time of the last accessed all files in .

On Windows and other operating systems, each file will have certain attributes that help determine its properties.

In , each file will have a timestamp that includes

  1. Date and time of creation.
  2. The date and time were last modified.
  3. The date and time last accessed.
TOP TUTORIALS:  File Sharing between Hyper-V Host and Guest

You can find this information in each file or folder, regardless of the type of file, whether the file is a document, photo, video, , and folder. If you copy or move the file elsewhere, this information will also follow the file.

timestamp file

To check the timestamp you can do it with and then right-click the file and select “Properties“.

If you need to modify this timestamp attribute, there are several methods you can use, including a command-line approach by using and some third-party tools.

TOP TUTORIALS:  Creating a Windows Service from an executable file

Change the creation date and time on a File in Windows

To change the date and time of the creation of the File, you can do it by typing a  command in the following format in Windows .

(Get-Item "FilePath"). CreationTime=("mm/dd/yyyy hh:mm:ss")

For example, to change the creation date of the file “D:\bardimin\tes01.txt”, it would be something like this.

(Get-Item "D:\bardimin\tes01.txt"). CreationTime=("08/29/2022 9:45:00")

Change the Date and Time Last Modified in Files in Windows

As for changing the last information of the edited file, you can use the command:

(Get-Item "FilePath"). LastWriteTime=("mm/dd/yyyy hh:mm:ss")

Change the Date and Time Last Accessed in Files in Windows

To change the date and time a file was last accessed by a user, use the following command.

(Get-Item "FilePath"). LastAccessTime=("mm/dd/yyyy hh:mm:ss")

Change the date and time of all Files in a Folder in Windows

You also change at once all the files in one folder and all the timestamps by using the following command in PowerShell.

$modifyfiles = Get-ChildItem -force FolderPath | Where-Object {! $_.PSIsContainer}
foreach($object in $modifyfiles)
	$object.CreationTime=("mm/dd/yyyy hh:mm:ss")
	$object.LastAccessTime=("mm/dd/yyyy hh:mm:ss")
	$object.LastWritetime=("mm/dd/yyyy hh:mm:ss")

FolderPath: The of the target folder.

TOP TUTORIALS:  How to Limit Internet Data Usage in Windows 11

As an example of changing all the timestamps of files in the “D:\bardimin” folder, the writing will be like this.

$modifyfiles = Get-ChildItem -force D:\bardimin\* | Where-Object {! $_.PSIsContainer}
foreach($object in $modifyfiles)
	$object.CreationTime=("08/29/2002 9:45:00")
	$object.LastAccessTime=("08/29/2002 9:45:00")
	$object.LastWritetime=("08/29/2002 9:45:00")


Submit a Comment