Created
July 23, 2014 13:04
-
-
Save dfinke/e29ef6fcd6786c7db35a to your computer and use it in GitHub Desktop.
`Get-TimeStamp -Yesterday -ToClipboard` - Example, copy a TS to the clipboard, using it to name files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-TimeStamp { | |
param( | |
[Switch]$Yesterday, | |
[Switch]$ToClipboard | |
) | |
$date = Get-Date | |
if($Yesterday) { | |
$date = $date.AddDays(-1) | |
} | |
$r=$date.tostring("yyyyMMdd") | |
if($ToClipboard) { return $r | clip } | |
$r | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment