Quantity of time from difference of two Datetime values?

Quantity of time from difference of two Datetime values?

am 01.10.2011 05:08:29 von Jan Steinman

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 subtracting two arbitrary Datetimes to get something that is =
useful. A simple subtraction yields the least useful thing possible: a =
modulo-100 difference of modulo-60 quantities. Other functions yield the =
proper answer, but not for a quantity of time that rolls over midnight, =
etc.

Surely, there are tons of payroll apps that subtract the punch-out from =
the 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 =
difference between two arbitrary Datetimes? Did I overlook something =
simple? Do I need to convert the two to scalar integers first?



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg

Re: Quantity of time from difference of two Datetime values?

am 01.10.2011 05:22:54 von Hank

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.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg

Re: Quantity of time from difference of two Datetime values?

am 01.10.2011 14:08:52 von (Halász Sándor) hsv

>>>> 2011/09/30 20:08 -0700, Jan Steinman >>>>
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 subtracting two arbitrary Datetimes to get something that is useful. A simple subtraction yields the least useful thing possible: a modulo-100 difference of modulo-60 quantities. Other functions yield the proper answer, but not for a quantity of time that rolls over midnight, etc.
<<<<<<<<
You mean timestamps that are less than a full day apart?

"TIMESTAMPDIFF(SECOND, ...)" does not work for you? There is also "TO_SECONDS".


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: Quantity of time from difference of two Datetime values?

am 02.10.2011 08:31:51 von Jan Steinman

Thanks, Hank!

I figured it was something like that, but couldn't see any clear =
documentation on the Oracle reference page on date/time functions.

On Sep 30, 2011, at 8:22 PM, Hank wrote:

> 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 subtracting two arbitrary Datetimes to get something that is =
useful. A simple subtraction yields the least useful thing possible: a =
modulo-100 difference of modulo-60 quantities. Other functions yield the =
proper answer, but not for a quantity of time that rolls over midnight, =
etc.
>>=20
>> Surely, there are tons of payroll apps that subtract the punch-out =
from the punch-in to come up with a quantity of time?
>>=20
>> What is YOUR favourite way of coming up with a quantity of time as =
the difference between two arbitrary Datetimes? Did I overlook something =
simple? Do I need to convert the two to scalar integers first?
>=20
>=20
> See the unix_timestamp() function. Converts date/times to a scalar
> integer of the number of seconds since the Unix Epoch.


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg