Porting from mysql to psql (UNIX_TIMESTAMP()?) - Mailing list pgsql-sql

From Zlatko Calusic
Subject Porting from mysql to psql (UNIX_TIMESTAMP()?)
Date
Msg-id 874s3p3k1c.fsf@atlas.iskon.hr
Whole thread Raw
Responses Re: Porting from mysql to psql (UNIX_TIMESTAMP()?)
List pgsql-sql
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...

pgsql-sql by date:

Previous
From: Roberto Mello
Date:
Subject: Creating an aggregate function
Next
From: Zlatko Calusic
Date:
Subject: Re: [GENERAL] Porting from mysql to psql (UNIX_TIMESTAMP()?)