Skip to content

Instantly share code, notes, and snippets.

@Rudde
Created September 7, 2018 14:25
Show Gist options
  • Save Rudde/73d58d333ad3e21429fbceb59c21d95f to your computer and use it in GitHub Desktop.
Save Rudde/73d58d333ad3e21429fbceb59c21d95f to your computer and use it in GitHub Desktop.
Function Format-Time() {
Param ([int]$ms)
If ($ms -gt 3600000) {[string]::Format("{0:0.00} hours", $ms / 3600000)}
ElseIf ($ms -gt 60000) {[string]::Format("{0:0.00} minutes", $ms / 60000)}
ElseIf ($ms -gt 1000) {[string]::Format("{0:0.00} seconds", $ms / 1000)}
ElseIf ($ms -gt 0) {[string]::Format("{0:0.00} milliseconds", $ms)}
Else {"0 milliseconds"}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment