Skip to content

Instantly share code, notes, and snippets.

@Timberfang
Created August 3, 2022 14:51
Show Gist options
  • Save Timberfang/4d9ca7a8f5440c1def56e740dedc2fda to your computer and use it in GitHub Desktop.
Save Timberfang/4d9ca7a8f5440c1def56e740dedc2fda to your computer and use it in GitHub Desktop.
Simple wrapper for New-TimeSpan
Set-StrictMode -Version 3.0
#Requires -Version 3.0
[int]$Hours = Read-Host -Prompt "Enter the number of hours"
[int]$Minutes = Read-Host -Prompt "Enter the number of minutes"
[int]$Seconds = Read-Host -Prompt "Enter the number of seconds"
if(-not($Hours)){
$Hours = 0
}
if(-not($Minutes)){
$Minutes = 0
}
if(-not($Seconds)){
$Seconds = 0
}
New-TimeSpan -Hours $Hours -Minutes $Minutes -Seconds $Seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment