Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 06-04-2005, 12:19 PM   #1
LQ Newbie
Registered: Sep 2004
Posts: 27

Rep: Reputation: 15
Mysql time difference

Hi Guys,

How do i calculate time difference between two time stamps in mysql?

I have a datetime field with data in the format YYYY-MM-DD HH:MM:SS

I need a difference in seconds. So i tried ..

select now() - mydatetimefield from mytable;

This is giving me a weird values and not exactly the difference in seconds.

Can you help?
Old 06-04-2005, 01:05 PM   #2
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 6,230

Rep: Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724
Have a look to :


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
FTP 4 hour time difference... Santinelli Linux - Enterprise 1 09-08-2005 11:04 AM
why do we have the 22 second time difference? masand LQ Suggestions & Feedback 7 03-30-2005 10:40 PM
PHP difference between --without-mysql and progressdll Linux - Software 0 10-14-2004 07:44 AM
[mysql] difference between Mysql Max or Normal BlackCell Programming 2 11-06-2003 05:41 PM
Time difference when sending out mail. chuck77 Linux - General 2 05-30-2002 02:37 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:29 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration