now() + integer, not rounded to whole day

Is it possible to add some portion of the day to now() ? I cannot
round now() to whole days like now()::date. Hours, minutes and seconds
are also important to me. This I had in Oracle, and need to convert it
:

sysdate + 1/1440

Thanks for any suggestion.
jirinej [ Fr, 22 Oktober 2004 14:04 ] [ ID #453871 ]

Re: now() + integer, not rounded to whole day

jirinej [at] volny.cz (JN) wrote in message news:<7e29a94a.0410220404.314f4308 [at] posting.google.com>...
> Is it possible to add some portion of the day to now() ? I cannot
> round now() to whole days like now()::date. Hours, minutes and seconds
> are also important to me. This I had in Oracle, and need to convert it
> :
>
> sysdate + 1/1440
>
> Thanks for any suggestion.

It's simpler than I thought

now() + (TO_TIMESTAMP('1970-01-01 00:01:00', 'yyyy-mm-dd HH24:MI:SS')
- TO_TIMESTAMP('1970-01-01 00:00:00', 'yyyy-mm-dd HH24:MI:SS'))
jirinej [ Mo, 25 Oktober 2004 11:27 ] [ ID #453879 ]

Re: now() + integer, not rounded to whole day

On Mon, Oct 25, 2004 at 02:27:01 -0700,
JN <jirinej [at] volny.cz> wrote:
> jirinej [at] volny.cz (JN) wrote in message news:<7e29a94a.0410220404.314f4308 [at] posting.google.com>...
> > Is it possible to add some portion of the day to now() ? I cannot
> > round now() to whole days like now()::date. Hours, minutes and seconds
> > are also important to me. This I had in Oracle, and need to convert it
> > :
> >
> > sysdate + 1/1440
> >
> > Thanks for any suggestion.
>
> It's simpler than I thought
>
> now() + (TO_TIMESTAMP('1970-01-01 00:01:00', 'yyyy-mm-dd HH24:MI:SS')
> - TO_TIMESTAMP('1970-01-01 00:00:00', 'yyyy-mm-dd HH24:MI:SS'))

You probably wanted to do something like: now() + '1 hour'::interval

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend
Bruno [ Mo, 25 Oktober 2004 18:32 ] [ ID #453885 ]
Datenbanken » comp.databases.postgresql.sql » now() + integer, not rounded to whole day

Vorheriges Thema: Re: "copy from" in "create function"
Nächstes Thema: sql