Skip to content

Instantly share code, notes, and snippets.

@Kielx
Forked from seanwu1105/README.md
Last active August 1, 2025 06:59
Show Gist options
  • Select an option

  • Save Kielx/bf64220d43e966604ba384b1fc8e1954 to your computer and use it in GitHub Desktop.

Select an option

Save Kielx/bf64220d43e966604ba384b1fc8e1954 to your computer and use it in GitHub Desktop.
Change the last modified, creation and access time of files in Windows.
# Change Timestamps in Windows
## Get Started
### Open PowerShell
Open PowerShell in the target directory. Normally, you can open PowerShell in current directory by holding <kbd>shift</kbd> and right-clicking the context menu **Open PowerShell Here**.
### Use the Following Commands
#### Change Creation Time
``` powershell
$(Get-Item FILENAME).creationtime=$(Get-Date "DD/MM/YYYY HH:MM am/pm")
```
#### Change Last Access Time
``` powershell
$(Get-Item FILENAME).lastaccesstime=$(Get-Date "DD/MM/YYYY HH:MM am/pm")
```
#### Change Last Modified Time
``` powershell
$(Get-Item FILENAME).lastwritetime=$(Get-Date "DD/MM/YYYY HH:MM am/pm")
```
## Examples
To change the creation time of the file `filename.mp4` in current folder to current date time, use the following command.
``` powershell
$(Get-Item ".\filename.mp4").lastwritetime=$(Get-Date)
```
To change the last modified time of the file `filename.mp4` in current folder to **11/24/2015 06:00 am**, use the following command.
``` powershell
$(Get-Item ".\filename.mp4").lastwritetime=$(Get-Date "11/24/2015 06:00 am")
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment