From ec73a55fe4a5b3eb7dcc58a5fc772effcc0e5436 Mon Sep 17 00:00:00 2001 From: KnifMelti Date: Mon, 19 Sep 2022 23:45:18 +0200 Subject: [PATCH] Format Date/Time --- Winget-AutoUpdate/functions/Test-ListPath.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Winget-AutoUpdate/functions/Test-ListPath.ps1 b/Winget-AutoUpdate/functions/Test-ListPath.ps1 index 7265d06..a7eb71d 100644 --- a/Winget-AutoUpdate/functions/Test-ListPath.ps1 +++ b/Winget-AutoUpdate/functions/Test-ListPath.ps1 @@ -16,8 +16,8 @@ function Test-ListPath ($ListPath, $UseWhiteList) { $ExternalList = -join($ListPath, "\", $ListType, "_apps.txt") if(Test-Path -Path $ExternalList -PathType leaf){ Write-Output "Given path $ListPath type is $PathType and $ExternalList is available..." - $dateLocal = (Get-Item "$LocalList").LastWriteTime - $dateExternal = (Get-Item "$ListPath").LastWriteTime + $dateLocal = (Get-Item "$LocalList").LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss") + $dateExternal = (Get-Item "$ListPath").LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss") if ($dateExternal -gt $dateLocal) { Write-Host("$ExternalList is newer than $LocalList") } @@ -33,8 +33,8 @@ function Test-ListPath ($ListPath, $UseWhiteList) { try { $wc.OpenRead("$ExternalList").Close() | Out-Null Write-Output "Given path $ListPath type is $PathType and $ExternalList is available..." - $dateLocal = (Get-Item "$LocalList").LastWriteTime - $dateExternal = $wc.ResponseHeaders['Last-Modified'] + $dateLocal = (Get-Item "$LocalList").LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss") + $dateExternal = ([DateTime]$wc.ResponseHeaders['Last-Modified']).ToString("yyyy-MM-dd HH:mm:ss") if ($dateExternal -gt $dateLocal) { Write-Host("$ExternalList is newer than $LocalList") } @@ -48,8 +48,8 @@ function Test-ListPath ($ListPath, $UseWhiteList) { $ExternalList = -join($ListPath, "\", $ListType, "_apps.txt") if(Test-Path -Path $ExternalList -PathType leaf){ Write-Output "Given path $ListPath type is $PathType and $ExternalList is available..." - $dateLocal = (Get-Item "$LocalList").LastWriteTime - $dateExternal = (Get-Item "$ListPath").LastWriteTime + $dateLocal = (Get-Item "$LocalList").LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss") + $dateExternal = (Get-Item "$ListPath").LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss") if ($dateExternal -gt $dateLocal) { Write-Host("$ExternalList is newer than $LocalList") }