Re: [SQL] Unix dateformat ?

From: George Moga <george(at)flex(dot)ro>
To: Zsolt Varga <redax(at)agria(dot)hu>, SQL PostgreSQL <pgsql-sql(at)postgreSQL(dot)org>
Subject: Re: [SQL] Unix dateformat ?
Date: 1998-12-15 09:11:00
Message-ID: 367627A3.32999BDB@flex.ro
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)flex(dot)ro
george(at)cicnet(dot)ro
Braila, ROMANIA.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jan Wieck 1998-12-15 09:11:45 Re: [SQL] CREATE RULE question
Previous Message Zsolt Varga 1998-12-15 08:49:00 Mea Culpa (was: Unix dateformat ?)