I want to Unshare records by Query which I shared 1 month ago.
List<CustomObject> rec = [SELECT Id, CreatedDate FROM CustomObject WHERE CreatedDate <Whatever Date];
How I can get Shared date from Shared records?
Sharing-table records don't have a
CreatedDate field. You can query against their
LastModifiedDate, if you need to. Remember that, if the
Manual, those records could have been modified by users or by other functionality since you created them, and other sharing records could have been modified on the same date.
The safest approach is to write your queries based on how you originally identified the records you wished to share or that you now wish to unshare, not to query based on the modification dates of the sharing records.