File modification time: Difference between revisions

Content added Content deleted
m (→‎{{header|PowerShell}}: added mentions of LastAccessTime and CreationTime)
Line 680: Line 680:


=={{header|PowerShell}}==
=={{header|PowerShell}}==
<lang powershell>$modificationTime = (Get-ChildItem file.txt).LastWriteTime
<lang powershell>
$modificationTime = (Get-ChildItem file.txt).LastWriteTime
Set-ItemProperty file.txt LastWriteTime (Get-Date)</lang>
Set-ItemProperty file.txt LastWriteTime (Get-Date)

$LastReadTime = (Get-ChildItem file.txt).LastAccessTime
Set-ItemProperty file.txt LastAccessTime(Get-Date)

$CreationTime = (Get-ChildItem file.txt).CreationTime
Set-ItemProperty file.txt CreationTime(Get-Date)
</lang>

You can also use alternates to get UTC time:
LastWriteTimeUtc
LastAccessTimeUtc
CreationTimeUtc


=={{header|PureBasic}}==
=={{header|PureBasic}}==