Обсуждение: Date/Time problem -(((

Поиск
Список
Период
Сортировка

Date/Time problem -(((

От
Boris
Дата:
Hello

I am moving from MySQL to Postgres and while converting my sql code I
have a lot of problems with this construction:

($ze is current time - 300 secounds):

delete from onlineuser where datum < FROM_UNIXTIME($ze)

Is there any Date/Time function in PGSQL? I want as shown in this
example delete entries older than 300 secounds.

I postet to the list because I have found no solution in the
tutorials and search-engine (maybe searched with wrong words?)

It would be great if someone could help me / point me to the right
way...

--
Boris




Re: Date/Time problem -(((

От
Kaare Rasmussen
Дата:
> Is there any Date/Time function in PGSQL? I want as shown in this
> example delete entries older than 300 secounds.
>
> I postet to the list because I have found no solution in the
> tutorials and search-engine (maybe searched with wrong words?)

http://www.postgresql.org/users-lounge/docs/7.0/postgres/functions2876.htm

-- 
Kaare Rasmussen            --Linux, spil,--        Tlf:        3816 2582
Kaki Data                tshirts, merchandize      Fax:        3816 2501
Howitzvej 75               �ben 14.00-18.00        Email: kar@webline.dk
2000 Frederiksberg        L�rdag 11.00-17.00       Web:      www.suse.dk


RE: Date/Time problem -(((

От
"Francis Solomon"
Дата:
Hi Boris,

I know Kaare Rasmussen posted a URL to the online documentation already,
but this might be a direct solution to your problem:

DELETE FROM onlineuser WHERE datum < ('now'::datetime - '5
minutes'::interval);

Hope this helps

Francis Solomon

> Hello
>
> I am moving from MySQL to Postgres and while converting my sql code I
> have a lot of problems with this construction:
>
> ($ze is current time - 300 secounds):
>
> delete from onlineuser where datum < FROM_UNIXTIME($ze)
>
> Is there any Date/Time function in PGSQL? I want as shown in this
> example delete entries older than 300 secounds.
>
> I postet to the list because I have found no solution in the
> tutorials and search-engine (maybe searched with wrong words?)
>
> It would be great if someone could help me / point me to the right
> way...
>
> --
> Boris



Re[2]: Date/Time problem -(((

От
Boris
Дата:
Hello Francis,

Tuesday, January 02, 2001, 3:23:49 AM, you wrote:

FS> Hi Boris,

FS> I know Kaare Rasmussen posted a URL to the online documentation already,
FS> but this might be a direct solution to your problem:

FS> DELETE FROM onlineuser WHERE datum < ('now'::datetime - '5
FS> minutes'::interval);

FS> Hope this helps

FS> Francis Solomon

Yes this helps me a lot thanks!!!!


--
Boris