2012-04-14 18 views

回答

4

試試這個:

[datetime]::ParseExact("09:00","hh:mm",$null) 
+0

我喜歡單線。謝謝 – resolver101 2012-04-15 12:04:26

1

這應該工作:

$CurrentTime = [System.DateTime]::Parse((date).ToString("yyyy.MM.dd")) 
$Time = [System.Timespan]::Parse("9:00") 
$Result = $CurrentTime.Add($Time) 
0
Get-Date -Year $CurrentTime.Year ` 
     -Month $CurrentTime.Month ` 
     -Day $CurrentTime.Day ` 
     -Hour $time.split(':')[0] ` 
     -Minute $time.split(':')[-1] 
     -Second $time.split(':')[-1] 
+0

不正確的,因爲秒鐘時間 – 2012-04-15 06:45:22

+0

不是,你可以通過-Seconds參數介紹一下爲好,我將更新我的答案。 – 2012-04-15 07:09:51

相關問題