5 messages in com.mysql.lists.mysqlSubtracting Dates
FromSent OnAttachments
Ken Kinder15 Nov 2001 15:31 
Walter D. Funk16 Nov 2001 06:23 
Ken Kinder16 Nov 2001 10:09 
Mark Rissmann29 Nov 2001 12:12 
Ken Kinder29 Nov 2001 12:13 
Subject:Subtracting Dates
From:Ken Kinder (ke@notenetwork.com)
Date:11/15/2001 03:31:56 PM
List:com.mysql.lists.mysql

The date addition and subtraction functions in mysql don't seem to quiet do this. I was wondering if anyone know a way I could do this in the query:

Say you have two fields, start_time, and end_time, representing the start and end of a period of time. Both are datetime datatypes. What I want is the logical equivalent of:

select end_time - start_time as duration from ....

I want the difference between those two, such that it would say "0 days, 4 hours" or something.