Subject | Re: UNIX_TIMESTAMP to What for FB15 |
---|---|
Author | dleec45 |
Post date | 2004-05-25T00:30:39Z |
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...>
wrote:
wrote:
> Lee,CAST
>
> At 08:25 PM 24/05/2004 +0000, you wrote:
> >I searched this site for UNIX_TIMESTAMP and other places in order to
> >know how to deal with this in FB15. I'm converting a MySQL system and
> >this is in a query that is blowing up on me. Here's the query and if
> >anyone has any ideas on how do deal with this, I would love to hear
> >your comments.
> >
> >$Query = "SELECT ID, Headline, Summary, Body, Location, " .
> >"UNIX_TIMESTAMP(Expires) AS Expires, DisplayPrecedence " .
> >"FROM news " .
> >"WHERE expires > 'NOW()' ";
>
> Firebird uses standard SQL and doesn't support platform-specific
> formats. Find out what the UNIX_TIMESTAMP format represents and use
> if necessary. The date literal 'NOW' is supported, but deprecated, andthe MySQL
> needs to be cast to a TIMESTAMP type in Firebird for comparisons. You
> would do better to replace it with the standard SQL context variable
> CURRENT_TIMESTAMP.
>
> If your EXPIRES column is already a TIMESTAMP type, simply remove
> function call. If it is a DATE type, then useIf
> WHERE CAST(Expires as TIMESTAMP) > CURRENT_TIMESTAMP. The CAST will
> convert the DATE to a TIMESTAMP with a time part of '00:00:00.0000'.
> you are only wanting to compare a DATE with a DATE, then replace theWHERE
> clause withCURRENT_TIMESTAMP worked great, THANKS! LEE
> WHERE Expires > CURRENT_DATE.
>