First off, I want to apologize beforehand, as I know there is a lot of information about this subject on the net. But this has been annoying me the whole day.
In my database (MySQL), I have comments stored with the time they have been written (by using CURRENT_TIMESTAMP). Now I would like to make a script that relates the time between the present and the time that a user wrote a comment (for instance "comment written 6 hours ago…").
But here’s the thing, I have tried loads of different scripts and I’m always ending up with the same question. How do I convert my CURRENT_TIMESTAMP to the type of date the script wants me to use?
In the link above there’s a code, and you should define the variable with a date. Now, I have the CURRENT_TIMESTAMP and it looks like this: 2012-01-15 16:21:32
Should I just do the date (2012-01-15 16:21:32)?
Sorry again, I know there’s a lot of information about this on the web, but I’ve been working on this the whole day without results.
Yes, I tried the format you had in the post and it worked.