PowerShell: Comparing dates

前端 未结 3 923
被撕碎了的回忆
被撕碎了的回忆 2021-02-06 21:01

I am querying a data source for dates. Depending on the item I am searching for, it may have more than date associated with it.

get-date ($Output | Select-Object         


        
3条回答
  •  闹比i
    闹比i (楼主)
    2021-02-06 22:03

    As Get-Date returns a DateTime object you are able to compare them directly. An example:

    (get-date 2010-01-02) -lt (get-date 2010-01-01)
    

    will return false.

提交回复
热议问题