Subject | Re: [ib-support] Cannot calculate value between date and timestamp |
---|---|
Author | Helen Borrie |
Post date | 2003-05-14T05:59:26Z |
At 04:13 AM 14/05/2003 +0000, you wrote:
or a timestamp from another timestamp; otherwise explicit casting is
necessary.
select current_timestamp - CAST (current_date as timestamp) as DateDiff from...
This will return a number that is less than one but greater than zero, a
fraction of a day.
select current_date - CAST(current_timestamp as date) as DateDiff from..
will return zero
Your query
select CAST(current_date as timestamp) - current_timestamp from ...
will return a negative number that is greater than -1.
heLen
>Hi,They are different data types. You can subtract a date from another date,
>
>I cannot calculate number of days between a date value and a
>timestamp value in the select statement, such as
>
>select current_date-current_timestamp from ...
>
>It shows error:
>
>expression evaluation not supported.
>
>I have to cast them as the same type. Is it a bug or intended to be
>so?
>
>It happens with RC2.
or a timestamp from another timestamp; otherwise explicit casting is
necessary.
select current_timestamp - CAST (current_date as timestamp) as DateDiff from...
This will return a number that is less than one but greater than zero, a
fraction of a day.
select current_date - CAST(current_timestamp as date) as DateDiff from..
will return zero
Your query
select CAST(current_date as timestamp) - current_timestamp from ...
will return a negative number that is greater than -1.
heLen