Subject Re: Decrement Date by 1 hour
Author Adam
--- In firebird-support@yahoogroups.com, "Adam" <s3057043@...> wrote:
>
> --- In firebird-support@yahoogroups.com, "Dion" <27824912424@>
> wrote:
> >
> > Hi,
> >
> >
> >
> > How do I decrement the system date by an hour ie
current_timestamp –
> 1 hour.
> >
>
> Timestamp math. Each unit is worth 1 day. To add a day to a
> timestamp, add 1 to it, to add 5 minutes, add 5/1440, to subtract 1
> hour, subtract 1/24
>
> eg:
>
> select current_timestamp - 1/24
> from RDB$DATABASE;
>
> Pretty simple really.
>
>
> Adam
>

But watch the integer division gotcha. 1/24 = 0 according to SQL
standard. So try this.

select current_timestamp - (1.0/24.0)
from RDB$DATABASE;

Adam