Subject Re: [firebird-support] datetime trunc
Author Alan McDonald

Cast the result of the extract as a date or timestamp.

On 12/02/2014 6:20 AM, "Mark Rotteveel" <mark@...> wrote:
On 11-2-2014 16:06, Virna Constantin wrote:
>
>
> EXTRACT()
> http://www.firebirdsql.org/refdocs/langrefupd25-intfunc-extract.html

Extract is not the same as PostgreSQL date_trunc. Extract returns the
requested value as an integer, while date_trunc returns a DATE or
TIMESTAMP truncated to the requested date field, example from
http://www.postgresql.org/docs/current/static/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC
:

SELECT date_trunc('hour', TIMESTAMP '2001-02-16 20:38:40');
Result: 2001-02-16 20:00:00

SELECT date_trunc('year', TIMESTAMP '2001-02-16 20:38:40');
Result: 2001-01-01 00:00:00

> On Tuesday, February 11, 2014 4:42 PM, Maximiliano Robaina
> <maxi_robaina@...> wrote:
>
> Hi,
>
> Is there an equivalent function to trunc datetime fields in firebird ?
> Something like date_trunc in postgre [1]


------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Resources item
on the main (top) menu.  Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Yahoo Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/firebird-support/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/firebird-support/join
    (Yahoo! ID required)

<*> To change settings via email:
    firebird-support-digest@yahoogroups.com
    firebird-support-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    firebird-support-unsubscribe@yahoogroups.com

<*> Your use of Yahoo Groups is subject to:
    http://info.yahoo.com/legal/us/yahoo/utos/terms/