Skip to content

Instantly share code, notes, and snippets.

@dfinke
Created July 23, 2014 13:04
Show Gist options
  • Save dfinke/e29ef6fcd6786c7db35a to your computer and use it in GitHub Desktop.
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
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