HI Daly, Thanks A lot.
Eldo Skaria. On Tue, 21 Sep 2004 16:09:03 -0500, Eamon Daly <[EMAIL PROTECTED]> wrote: > Just to be a little more clear, when you're doing the > subtraction like so: > > "2004-09-01 07:38:00" - "2004-09-01 07:37:58" > > MySQL converts each to numeric representations thusly: > > 20040901073800 - 20040901073758 > > which, like most things in the universe, equals 42, /not/ > the 2 I think you were expecting. What you need to do is > convert the times to seconds and /then/ subtract: > > mysql> select * from whee; > +---------------------+---------------------+ > | start | end | > +---------------------+---------------------+ > | 2004-09-01 07:37:58 | 2004-09-01 07:38:00 | > +---------------------+---------------------+ > 1 row in set (0.00 sec) > > mysql> SELECT end - start AS numeric_calc, > -> TIME_TO_SEC(end) - TIME_TO_SEC(start) AS time_calc > -> FROM whee; > +--------------+-----------+ > | numeric_calc | time_calc | > +--------------+-----------+ > | 42 | 2 | > +--------------+-----------+ > 1 row in set (0.00 sec) > > ____________________________________________________________ > Eamon Daly > > > > > ----- Original Message ----- > From: "Gleb Kozyrev" <[EMAIL PROTECTED]> > To: "Eldo Skaria" <[EMAIL PROTECTED]> > Cc: "MySQL List" <[EMAIL PROTECTED]> > Sent: Tuesday, September 21, 2004 2:31 PM > Subject: Re: Anomaly in date subtraction > > > On Wed, 22 Sep 2004 00:20:32 +0530, Eldo Skaria <[EMAIL PROTECTED]> > > wrote: > >> That seems to be vague to me. > >> I would like to know how the time is converted to numbers? is it upto > >> seconds or even beyond that? > >> happier if resolved, > >> > > > > It is converted in such a way that looking at number we can easily read > > the date > > > > mysql> select now(), now() + 0; > > +---------------------+----------------+ > > | now() | now() + 0 | > > +---------------------+----------------+ > > | 2004-09-21 22:29:30 | 20040921222930 | > > +---------------------+----------------+ > > > > Please read the manual. > > 6.3.4 Date and Time Functions > > > > -- > > With best regards, Gleb Kozyrev. > > > > -- > > MySQL General Mailing List > > For list archives: http://lists.mysql.com/mysql > > To unsubscribe: > > http://lists.mysql.com/[EMAIL PROTECTED] > > > > -- Thanks & Regards, Eldo Skaria -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]