Time Window
i want parse list of items (sum) within strict time window. want include matches 5:00 pm yesterday 4:49:49 pm today
i using following code:
$timestart = $field[4]
$timeend = $field[5]
$tstart = get-date $timestart
$tend = get-date $timeend
$timediff = ($tend - $tstart)
$timediffseconds = $timediff.seconds
$timetoday = get-date
if (($timestart -ge $timetoday.adddays(-1)) -and ($timestart -le $timetoday)) {
write-host "within time window"
}
if server busy task not scheduled right away , numbers skewed. how can change get-date (get-date 5 pm today)?
not sure if understand want. check this
ps h:\> get-date -hour 17 friday, november 12, 2010 5:14:42 pm ps h:\> get-date -hour 17 -minute 00 friday, november 12, 2010 5:00:45 pm ps h:\> get-date -hour 17 -minute 00 -second 00 friday, november 12, 2010 5:00:00 pm
ravikanth
http://www.ravichaganti.com/blog
twitter: @ravikanth
powershell 2.0 remoting - ebook
Windows Server > Windows PowerShell
Comments
Post a Comment