說明:透過Powershell抓取日期資料比對時錯誤
處理方式:字串轉日期再比對
$DateTest=[Datetime]::ParseExact("6/4/2023 AM 08:01:01", "M/d/yyyy tt hh:mm:ss", $null)
if($DateTest -ge ($ReportDate.AddDays(-1))){
echo "TRUE"
}else{
echo "FALSE"
}
全站熱搜
說明:透過Powershell抓取日期資料比對時錯誤
處理方式:字串轉日期再比對
$DateTest=[Datetime]::ParseExact("6/4/2023 AM 08:01:01", "M/d/yyyy tt hh:mm:ss", $null)
if($DateTest -ge ($ReportDate.AddDays(-1))){
echo "TRUE"
}else{
echo "FALSE"
}