PHP MYSQL TIMESTAMP

Hello, I'm trying to figure out how to subtract timestamps.

I've got a TIMESTAMP in MYSQL and would like PHP to calculate the number of days it has been up until the current date.

How do I go about doing this?
cfansAsked:
Who is Participating?
 
snoyes_jwCommented:
SELECT TO_DAYS(CURRENT_DATE()) - TO_DAYS(yourTimestampField) AS daysDifference FROM theTable;
0
 
snoyes_jwCommented:
SELECT DATEDIFF(CURRENT_DATE(), yourTimestampField) AS daysDifference FROM theTable;
0
 
cfansAuthor Commented:
Is there an alternative to this?  The version of MySQL I am using doesn't seem to support that function.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.