Sharepoint Powershell View filter updated, but list displays with not items

Occasional Contributor
In Sharepoint 2016 powershell, When I used date as filter and ran the script the view filter is updated. But the view is not displaying no data. But after i ran the script, open the view and just SAVE  it WITHOUT doing any changes, the data SHOWS up. I tried the filter with a text field and ran the script, the view is filter is updated and data is showing without opening the view and saving it. Any ideas why the date field filter is not showing the data empty though it has the filter value updated?



Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$ListName = "Tracker" $ViewName = "PrevMonth"

$w = Get-SPWeb" $l = $w.Lists[$ListName];

$view = $l.Views | ? { $_.Title -eq $ViewName } $viewQuery="11/20/2021"

if($view -ne $null) {
 $view.Query = $ViewQuery 
#Send message to output console write-host "View Updated Successfully!" -foregroundcolor green 
else { 
write-host "Could Not find: " -foregroundcolor red 



1 Reply
best response confirmed by gkolapp (Occasional Contributor)
This is solved by adding T00:00:00Z to the date.