Here's a quick and fast way of generating relative dates in any format.
This would return yesterday’s date in the format year-month-day. Remove the
ToString() method if you want the relative date as a true
This returns all error events from the System event log in the past 48 hours:
Get-EventLog -LogName System -EntryType Error -After (Get-Date).AddDays(-2)