in reply to calculate time(days)

How is DBI germaine to your question? By your question, I am wondering if you meant to ask how you compute the difference between two dates using SQL. If that's your question then we need to know the DBMS you are using, no? Otherwise, if you are asking how to do it in Perl, use Date::Calc. I like chicken.