RE: Covert datetime/interval to float
Posted in 1998
---------- From: Greg Sturn[SMTP:gsturn@comcom.com] Sent: Thursday, January 29, 1998 7:36 AM To: informix-list@iiug.org Subject: Covert datetime/interval to float Is it possible when using perform to convert the result of subtracting two datetime data types to a float, either directly or indirectly. Any help is greatly appreciated. I don't think there is a direct method of doing it. The only indirect method that springs to mind is to create a custom Perform runner with a function which does the required conversion in it. One issue you'd have to deal with is what are the precisions of the two input arguments, and what value do you want the float to represent. For example, you might provide two DATETIME YEAR TO DAY values, and then return a number of days between the two dates, or you might provide two DATETIME YEAR TO FRACTION(5) values and you might return the number of hours and fractions of an hour between the two times. You'd also need to consider what should be returned when one of the two input values is DATETIME YEAR TO MONTH and the other is DATETIME HOUR TO FRACTION(3). With a third input argument encoding the required return value, you should be able to handle almost anything in a single function. You'd need to have a good working knowledge of ESQL/C, even though you would not actually need to use the ESQL/C compiler to create this function - it can be written in pure C and compiled with the C compiler and linked with cperf to create the new custom runner. Yours, Jonathan Leffler (jleffler@visa.com) #include <bother.ms-exchange.h>