There is a feature of SOQL called ‘Date Literals’, Using this we can simply write query to get last 90days created records.
The below query will fetch accounts where it’s Created Dtae is more than 90 Days.
SELECT Id FROM Account WHERE CreatedDate > LAST_90_DAYS
There are a lot of other ‘Date Literals’ that we can use. Here is the full reference.