6 messages in com.mysql.lists.javaRE: How to find the Time Difference..
FromSent OnAttachments
Shridhar..03 Sep 2002 23:09 
DL Neil04 Sep 2002 02:45 
priyank04 Sep 2002 10:25 
DL Neil05 Sep 2002 10:09 
priyank05 Sep 2002 22:31 
jsjfrei06 Sep 2002 06:42 
Subject:RE: How to find the Time Difference..
From:priyank (priy@intersolutions.stpn.soft.net)
Date:09/04/2002 10:25:53 AM
List:com.mysql.lists.java

Hi Sridhar,

Try out this: Have the datatype for both columns as TIMESTAMP(14). This type shall store the time in the format YYYYMMDDHHMMSS. To calculate the difference, use the following query:

select (TimeOut - TimeIn) from EmployeeTable;

The result shall again be in the same format. For e.g. if the difference is 1 Hour, the result shall be : 00000000010000. Please note that the leading zeroes may not be displayed.

I hope this solves your problem.

-----Original Message----- From: Shridhar.. [mailto:shri@hotmail.com] Sent: Tuesday, September 04, 2001 9:38 AM To: ja@lists.mysql.com Subject: How to find the Time Difference..

database,odbc,java --

Hi All, I have a Table where in i am storing the Employee TimeIn and TimeOut Details.... I want to calculate the Number of Hours for which that employee has worked.. I have a Timein column and one for Time Out...

1) Can anyone please tell how to calculate the time difference?

2) Suppose that a person logs in at 10:00pm and leaves at 5am next day how should i solve this problem.. coz the date will change/...

Which datatype should i use to solve all these probs.......... If i use DATETIME datatype will it be solved,,,, coz now i am using Time datatype for timein and timeout......

In Short how to calculate the time difference ...

To unsubscribe, send a message to the address shown in the List-Unsubscribe header of this message. If you cannot see it, e-mail java@lists.mysql.com instead.