When using PowerShell, why can I not use the overloaded ToString() methods for the TimeSpan structure?
$ts = New-TimeSpan -Days 5
$ts.ToString("g")
Cannot find an overload for "ToString" and the argument count: "1".
At line:1 char:13
+ $ts.ToString <<<< ("g")
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodCountCouldNotFindBest
Is there a workaround?
$ts | Get-Membershows a single, parameterless overload, which on my laptop gives5.00:00:00which seems similar to passingToString("g"). What are you specifically after? – Ben Pilbrow Aug 25 '11 at 19:13"It's been " + $ts.Hours + " hours and "+ $ts.Days +" days since you took your love away". Cheesy song reference, sorry about that! – Ben Pilbrow Aug 25 '11 at 19:35