If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > time difference

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-15-03, 11:39
simarjitraina simarjitraina is offline
Registered User
 
Join Date: Nov 2003
Posts: 11
time difference

Does anybody know how to find difference between two times in hours
for ex 24:00:00 20:00:00 is 4 hours


thanks in advance

later
Reply With Quote
  #2 (permalink)  
Old 12-16-03, 07:07
Mincer Mincer is offline
Registered User
 
Join Date: Sep 2003
Location: London
Posts: 56
What data type is the column? Do you need this to work for rolling over days,weeks,years?

A little more info on the actual problem may help.

Matt.
Reply With Quote
  #3 (permalink)  
Old 12-19-03, 12:39
aaron_dba aaron_dba is offline
Registered User
 
Join Date: Dec 2003
Posts: 6
Have you looked at the manual -

http://www.mysql.com/doc/en/Date_and...functions.html

check out DATE_SUB,for example. Be real careful about any maniplation that overlaps days, so 1AM - 11PM the next day doesn't return a result you don't want.
Reply With Quote
  #4 (permalink)  
Old 12-19-03, 14:50
simarjitraina simarjitraina is offline
Registered User
 
Join Date: Nov 2003
Posts: 11
i did and it suggested me to do this

i can't use TIMEDIFF() because i have a older version

then i did this


Select (UNIX_TIMESTAMP(' EndTime') - UNIX_TIMESTAMP('StartTime')) as TotalMin from newsession";

now for this need to add date tooo , it is in the datbase but i don know how to put two fields in UNIX_TIMESTAMP()

i tried like this

Select (UNIX_TIMESTAMP('t_date EndTime') - UNIX_TIMESTAMP('t_date StartTime')) as TotalMin from newsession";

but it doesn't work

any clue on what is wrong here

thanks anyways
later
__________________
if u can't impress people with ur intelligence , confuse them with ur bullshit
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On