Archives of the TeradataForum
Message Posted: Thu, 23 May 2002 @ 15:26:08 GMT
Subj: | | Re: Calculations with timestamps |
|
From: | | Jim Calvert |
Michael:
Here is a working example of two dates and two times formatted into TimeStamps and then subtracted. You can probably rework it for your
needs.
SELECT
(CAST(((STARTDATE(DATE, FORMAT'YYYY-MM-DD'))(CHAR(10)))||' '|| STARTTIME AS TIMESTAMP(0))
-
CAST(((ENDDATE(DATE, FORMAT'YYYY-MM-DD'))(CHAR(10)))||' '|| ENDTIME AS TIMESTAMP(0))
) HOUR(3) TO SECOND(0) AS TIMEDIFF
FROM MYDATA_TRACKING;
Watch that your ODBC driver's settings output the resulting Interval in its correct time format.
Jim Calvert - NCR
|