From: Hank Date: October 1 2011 3:22am Subject: Re: Quantity of time from difference of two Datetime values? List-Archive: http://lists.mysql.com/mysql/225876 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable n Fri, Sep 30, 2011 at 11:08 PM, Jan Steinman wrote: > Okay, I've reviewed the online man page for date and time functions, and = I've played with several likely candidates, and I am still having trouble s= ubtracting two arbitrary Datetimes to get something that is useful. A simpl= e subtraction yields the least useful thing possible: a modulo-100 differen= ce of modulo-60 quantities. Other functions yield the proper answer, but no= t for a quantity of time that rolls over midnight, etc. > > Surely, there are tons of payroll apps that subtract the punch-out from t= he punch-in to come up with a quantity of time? > > What is YOUR favourite way of coming up with a quantity of time as the di= fference between two arbitrary Datetimes? Did I overlook something simple? = Do I need to convert the two to scalar integers first? See the unix_timestamp() function. Converts date/times to a scalar integer of the number of seconds since the Unix Epoch.