pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Zlatko Calusic <zlatko@iskon.hr>
To: pgsql-sql@postgresql.org
To: pgsql-general@postgresql.org
Subject: Porting from mysql to psql (UNIX_TIMESTAMP()?)
Date: 09 Sep 2000 13:02:39 +0200
Message-ID: <874s3p3k1c.fsf@atlas.iskon.hr> (raw)

Hi!

As subject says, we are currently porting all of our data, programs
and logic from mysql to postgresql. One of the things we have yet to
resolve is how to replace mysql's UNIX_TIMESTAMP() function we used
extensively in PosgreSQL?

Function works like this in mysql:

mysql> select start from connection limit 1;
+---------------------+
| start               |
+---------------------+
| 2000-07-03 20:12:37 |
+---------------------+
1 row in set (0.01 sec)

mysql> select UNIX_TIMESTAMP(start) from connection limit 1;
+-----------------------+
| UNIX_TIMESTAMP(start) |
+-----------------------+
|             962647957 |
+-----------------------+
1 row in set (0.00 sec)

Is there any similar functionality (returning unixish number of
seconds since 1970 from the timestamp field) in PostgreSQL?

I tried all of the available date/time functions, type casting but all
to no avail.

TIA,
-- 
Zlatko

P.S Is it bad manners crossposting to two pgsql mailing list? Still
new to PostgreSQL, still learning...



view thread (4+ messages)  latest in thread

Message-ID: <874s3p3k1c.fsf@atlas.iskon.hr>
Permalink:  ../874s3p3k1c.fsf@atlas.iskon.hr/
Also on:    postgresql.org/message-id/874s3p3k1c.fsf@atlas.iskon.hr

 · 

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: zlatko@iskon.hr, pgsql-general@postgresql.org
  Subject: Re: Porting from mysql to psql (UNIX_TIMESTAMP()?)
  In-Reply-To: <874s3p3k1c.fsf@atlas.iskon.hr>
  References: <874s3p3k1c.fsf@atlas.iskon.hr>

* 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