I have datatime field in mysql , im working with php .
how is the best way to calculate and present to the user how much time is past from current day to the time in the field ?
so it present me something like :
2 days ago ..
2 weeks ago ...
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
you can use the
DateDiff(CurrentTime, DatabaseTimeField)function. It will return you the difference between two dates inDays. Then you can use that those days to present the difference to users.e.g.