I'm making a news script and I currently have the time inserted into my DB when a comment is made. I need some help making a function that will take the time the comment was made and the current time and then calculate the number of years, months, weeks or days that have passed since the comment was made.
For example if a comment was made just over two days ago the output will be 2 days and if another was made three weeks and two days ago the output will be 3 weeks, 2 days ect....
I have no idea where to start...I would like to make sure leap year is taken into account too. I don't even know what the best way to store the time in the database is for this?
I would really appreciate any help.