pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: George Moga <george@flex.ro>
To: Zsolt Varga <redax@agria.hu>
To: SQL PostgreSQL <pgsql-sql@postgreSQL.org>
Subject: Re: [SQL] Unix dateformat ?
Date: Tue, 15 Dec 1998 11:11:00 +0200
Message-ID: <367627A3.32999BDB@flex.ro> (raw)
References: <Pine.LNX.3.96.981215090617.2087A-100000@lupus.agria.hu>

Zsolt Varga wrote:

> hi!
>
> correct me, but is this possible postgresql doesn't contains any function
> to convert date/datetime format to unix timestamp format?
>
> in mysql I can do it with:
>
> mysql> select unix_timestamp( now() ) as stamp;
> +-----------+
> | stamp     |
> +-----------+
> | 913710262 |
> +-----------+
>
> before I make any function in 'c', please if you know some solution inform me,

If I undestund what you want ... try this:

SELECT date_part('epoch', 'now'::datetime) as seconds;

This function returns:

  seconds
---------
913712585
(1 row)

I use PostgreSQL 6.4 on Red Hat Linux 5.2 with 2.0.36 kernel version.

--
Best,
        George Moga,
        george@flex.ro
        george@cicnet.ro
        Braila, ROMANIA.




view thread (2+ messages)

Message-ID: <367627A3.32999BDB@flex.ro>
Permalink:  ../367627A3.32999BDB@flex.ro/
Also on:    postgresql.org/message-id/367627A3.32999BDB@flex.ro

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: george@flex.ro, redax@agria.hu
  Subject: Re: [SQL] Unix dateformat ?
  In-Reply-To: <367627A3.32999BDB@flex.ro>
  References: <Pine.LNX.3.96.981215090617.2087A-100000@lupus.agria.hu> <367627A3.32999BDB@flex.ro>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox