Re: Subtracting Dates
Oh, well, I didn't really have a solution. I just took it all out in seconds, and did the math inside the application. On Thursday 29 November 2001 01:12 pm, Mark Rissmann wrote: It would be beneficial to the group if everyone would post their solutions to the list if they solve it on their own. IMHO, Mark -Original Message- From: Ken Kinder [mailto:[EMAIL PROTECTED]] Sent: Friday, November 16, 2001 10:10 AM To: Walter D. Funk; [EMAIL PROTECTED] Subject: Re: Subtracting Dates Well, I really do need the exact timespan in human-readable format. What I did do was get the difference in seconds, then properly format that manually. :/ Thanks anyway though. On Friday 16 November 2001 07:24 am, Walter D. Funk wrote: Why don´t you try select TO_DAYS(end_date)-TO_DAYS(start_date) as duration : this will return the difference in days if you need mor accuracy i.e. difference in hours, you should word on a TIMESTAMP 14 instead of date ; this data type holds up to seconds and is mathematically easy to operate ... i hope it helps - Original Message - From: Ken Kinder [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 15, 2001 8:32 PM Subject: Subtracting Dates 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. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Subtracting Dates
It would be beneficial to the group if everyone would post their solutions to the list if they solve it on their own. IMHO, Mark -Original Message- From: Ken Kinder [mailto:[EMAIL PROTECTED]] Sent: Friday, November 16, 2001 10:10 AM To: Walter D. Funk; [EMAIL PROTECTED] Subject: Re: Subtracting Dates Well, I really do need the exact timespan in human-readable format. What I did do was get the difference in seconds, then properly format that manually. :/ Thanks anyway though. On Friday 16 November 2001 07:24 am, Walter D. Funk wrote: Why don´t you try select TO_DAYS(end_date)-TO_DAYS(start_date) as duration : this will return the difference in days if you need mor accuracy i.e. difference in hours, you should word on a TIMESTAMP 14 instead of date ; this data type holds up to seconds and is mathematically easy to operate ... i hope it helps - Original Message - From: Ken Kinder [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 15, 2001 8:32 PM Subject: Subtracting Dates 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. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Subtracting Dates
Why don´t you try select TO_DAYS(end_date)-TO_DAYS(start_date) as duration : this will return the difference in days if you need mor accuracy i.e. difference in hours, you should word on a TIMESTAMP 14 instead of date ; this data type holds up to seconds and is mathematically easy to operate ... i hope it helps - Original Message - From: Ken Kinder [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 15, 2001 8:32 PM Subject: Subtracting Dates 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. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Subtracting Dates
Well, I really do need the exact timespan in human-readable format. What I did do was get the difference in seconds, then properly format that manually. :/ Thanks anyway though. On Friday 16 November 2001 07:24 am, Walter D. Funk wrote: Why don´t you try select TO_DAYS(end_date)-TO_DAYS(start_date) as duration : this will return the difference in days if you need mor accuracy i.e. difference in hours, you should word on a TIMESTAMP 14 instead of date ; this data type holds up to seconds and is mathematically easy to operate ... i hope it helps - Original Message - From: Ken Kinder [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 15, 2001 8:32 PM Subject: Subtracting Dates 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. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php