說明:透過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"
}
 

arrow
arrow
    全站熱搜

    Nathan 發表在 痞客邦 留言(0) 人氣()