Skip to content

Instantly share code, notes, and snippets.

@hagatorn
Created May 18, 2018 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hagatorn/b11594f70788b2bce541a66e17ed59a9 to your computer and use it in GitHub Desktop.
Save hagatorn/b11594f70788b2bce541a66e17ed59a9 to your computer and use it in GitHub Desktop.
param(
[CmdletBinding()]
[ValidatePattern('^(((?<days>[0-9]+)\+)?((?<hours>[0-9]{1,2}):))?(?<mins>[0-9]{1,2})$')]
[string]$quserTimeString
)
$quserTimeString -match '^(((?<days>[0-9]+)\+)?((?<hours>[0-9]{1,2}):))?(?<mins>[0-9]{1,2})$' | Out-Null
[Timespan]::new($Matches.days, $Matches.hours, $Matches.mins, 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment