Re: Sample SQL needed for DateDiff(minutes, Date1, date2)
Posted in 1997
A simple stored procedure should do the trick:
create procedure minutediff
(dt1 datetime year to fraction,dt2 datetime year to fraction)
returning interval minute(9) to minute;return (dt2-dt1);
end procedure;
Note that the values passed to dt1 and dt2 can be any datetime or date
types. Informix does the conversions for you.
Best wishes,
----------------------------------------------------------------------
John H. Frantz Power-4gl: Extending Informix-4gl
frantz@centrum.is http://www.rl.is/~john/pow4gl.html
In article <883424476.1040515073@dejanews.com>,
scummings@idesign.com wrote:
>
> I need to find the Informix equivalent of SQL Server's DateDiff(Minute,
> datetime1, datetime2) routine. Both dates will be defined as DateTime
> YEAR TO SECONDS and I want to know how many minutes date2 is from date1.
>
> For example, if datetime1 = 1/1/1997 11:10:05 and datetime2 = 1/1/1997
> 12:30:45 then the result I'm looking for is 80 minutes and not: 0 01:20
>
> Any help would be appreciated.
>
> Thank you!
>
> Steve Cummings
> Integrated Design, Inc.
> scummings@idesign.com_nospam --> remove '_nospam' for e-mail address
> www.idesign.com
>
> -------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet