RE: [MYSQL]Time formatting for cycle time.

2007-08-29 Thread Weston, Craig \(OFT\)
Peter, Baron and all, I think that I am almost there. Here's my query to return cycle time in hours:minutes:seconds accounting for business hours. There is some discussion as to when a ticket cycle time ends - for example if a person works on a ticket at 10:00 at night and closes it,

RE: [MYSQL]Time formatting for cycle time.

2007-08-28 Thread Weston, Craig (OFT)
Wow, thanks. Lots to think about. From: Peter Brawley [mailto:[EMAIL PROTECTED] Sent: Monday, August 27, 2007 10:18 PM To: Weston, Craig (OFT) Cc: mysql@lists.mysql.com Subject: Re: [MYSQL]Time formatting for cycle time. Craig, I am working on Martin

Re: [MYSQL]Time formatting for cycle time.

2007-08-28 Thread Baron Schwartz
To: Weston, Craig (OFT) Cc: mysql@lists.mysql.com Subject: Re: [MYSQL]Time formatting for cycle time. Craig, I am working on Martin Minka's date diff function as found at http://forge.mysql.com/snippets/view.php?id=56. It is a beautiful thing. However, I am trying to alter it or identify

RE: [MYSQL]Time formatting for cycle time.

2007-08-28 Thread Weston, Craig \(OFT\)
Ok, So, What I have come up with (so far) as a variant of Baron's query: SET @d1 = '2007-2-1 00:00:00';# Start date SET @d2 = '2007-2-28 23:59:59';# End date SET @tdiff = TIMEDIFF( TIME(@d1), TIME(@d2) ); SET @dow1 = DAYOFWEEK(@d1); SET @dow2 = DAYOFWEEK(@d2); SET @days = DATEDIFF(@d2,@d1); SET

RE: [MYSQL]Time formatting for cycle time.

2007-08-28 Thread Weston, Craig \(OFT\)
Ok then, Now I have a result set so very close to where I want to be. The query thus far: mysql SET @d1 = '2007-02-01 18:24:04';# Start date SET @d2 = '2007-2-28 23:05:40';# End date set @wkldays = (select WorkDayDiff`(@d2,@d1)-1); Set @wkldays2 = if(@wkldays 0,1,0); set @Day_End = (select

Re: [MYSQL]Time formatting for cycle time.

2007-08-28 Thread Peter Brawley
Craig, Right you are, here is a corrected func: DROP FUNCTION IF EXISTS BizDateTimeDiff; DELIMITER | CREATE FUNCTION BizDateTimeDiff( d1 DATETIME, d2 DATETIME ) RETURNS CHAR(30) DETERMINISTIC BEGIN DECLARE dow1, dow2, days, wknddays INT; DECLARE tdiff CHAR(10); SET dow1 = DAYOFWEEK(d1); SET

[MYSQL]Time formatting for cycle time.

2007-08-27 Thread Weston, Craig \(OFT\)
Hello all, I am working on Martin Minka's date diff function as found at http://forge.mysql.com/snippets/view.php?id=56. It is a beautiful thing. However, I am trying to alter it or identify a similar function that instead of giving me the number of days between two dates it returns

Re: [MYSQL]Time formatting for cycle time.

2007-08-27 Thread Peter Brawley
Craig, I am working on Martin Minka's date diff function as found at http://forge.mysql.com/snippets/view.php?id=56. It is a beautiful thing. However, I am trying to alter it or identify a similar function that instead of giving me the number of days between two dates it returns the number of