Today I needed a rule in hazel which was able to check if a file was older than X days.
-- Set the age of files that you want to keep
set keepDays to (360)
tell application “Finder”
set modDate to modification date of theFile
if modDate is less than ((current date)) - keepDays * days then
— File is younger than keepDays