1 Replies - 800 Views - Last Post: 09 August 2013 - 08:53 PM Rate Topic: -----

#1 adn258   User is offline

  • D.I.C Addict

Reputation: 12
  • View blog
  • Posts: 816
  • Joined: 31-August 11

How Do You Get The Difference Between Two Mysql Timestamps?

Posted 09 August 2013 - 05:38 PM

So I'm doing something wrong here and it's frustrating. If you have 1 column that's on update or add adds the current timestamp and the column type is type of timestamp.

I try to get the difference between the CURRENT TIMESTAMP and the column itself by something like this

(NOW() - ltime)



In a mysql QUERY but it doesn't work. In the query I've also tried

CURRENT_TIMESTAMP - ltime



Where ltime is the column of the saved timestamp which remember on default is supposed to default to the current_timestamp.

The format for the supposed timestamp looks like 2013-08-09 17:31:10 when a value is added and it enters something as default.


What am I doing wrong and how can I make this work? Thanks in advance guys.

Is This A Good Question/Topic? 0
  • +

Replies To: How Do You Get The Difference Between Two Mysql Timestamps?

#2 adn258   User is offline

  • D.I.C Addict

Reputation: 12
  • View blog
  • Posts: 816
  • Joined: 31-August 11

Re: How Do You Get The Difference Between Two Mysql Timestamps?

Posted 09 August 2013 - 08:53 PM

Never mind I'm really sorry guys I figured this one out for myself

 AND ((UNIX_TIMESTAMP() - UNIX_TIMESTAMP(ltime)) < 5)


This post has been edited by Dormilich: 09 August 2013 - 11:19 PM
Reason for edit:: fixed code tags

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1