As we are on the way to cleaning Production server, we need to find out the last usage date of each database. sothat we can clean the databases which are not used for a long time. Is there any way to find the last usage date of the database.

select
stat.database_id as database_id
,db.name as database_name
,max(stat.last_user_scan) as last_user_scan
from sys.dm_db_index_usage_stats as stat
join sys.databases as db
on db.database_id = stat.database_id
group by stat.database_id,db.name
order by db.name asc

select
stat.database_id as database_id
,db.name as database_name
,max(stat.last_user_scan) as last_user_scan
from sys.dm_db_index_usage_stats as stat
join sys.databases as db
on db.database_id = stat.database_id
group by stat.database_id,db.name
order by db.name asc

I dont think this script would work in all cases, if you have backup job or some other job runing on a weekly basis this query would show you latest date when the database was backed up for all the databases in the server.