I guess that might…just found that using

"$(New-TimeSpan -Start $StartDate -End $EndDate)"

Gives me a much better output format, don’t know how I stumbled on that though, 
probably a typo ☺

From: [email protected] [mailto:[email protected]] On 
Behalf Of Zvonimir Bilic
Sent: 21 October 2015 13:56
To: [email protected]
Subject: Re: [NTSysADM] PowerShell brain block

I think you can pipe the output and use select to select Hours, Minutes, etc...

On Wed, Oct 21, 2015 at 7:34 AM, James Rankin 
<[email protected]<mailto:[email protected]>> wrote:
I’m having a bad day, struggling with basic PowerShell functionality, help ☹

I’m trying to use the following command to return the difference between two 
times

New-TimeSpan -Start $StartDate -End $EndDate

Which works fine, but it returns a bunch of stuff like

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 25
Milliseconds      : 464
Ticks             : 254647496
TotalDays         : 0.000294730898148148
TotalHours        : 0.00707354155555556
TotalMinutes      : 0.424412493333333
TotalSeconds      : 25.4647496
TotalMilliseconds : 25464.7496

I just want to get it to return something like

0 Hours, 0 Minutes, 25 seconds

…but I’m having a total mental block and I appear to have lost the ability to 
do simple manipulation of PowerShell output, all I am managing after quite some 
time is a single line from

(New-TimeSpan -Start $StartDate -End $EndDate).TotalSeconds

Which just gives me “25”

can someone put me out of my misery?

Cheers,



James Rankin
EUC Director | HTG TaloSys | 07809 668579 | 
[email protected]<mailto:[email protected]>
One Trinity Green, Eldon Street, South Shields, Tyne & Wear, NE33 1SA
Tel: 0191 481 3489
Email address: [email protected]<mailto:[email protected]>
Website: www.talosys.co.uk<http://www.talosys.co.uk>
[phpy9YoGNAM]


Reply via email to