2

The question is pretty self-explanatory. I'm looking for a PostgreSQL equivalent to the SQLite datetime function.

3 Answers 3

6
postgres=# select to_char(now(),'YYYY-mm-dd HH:MM:ss');
       to_char
---------------------
 2008-09-24 02:09:20
(1 row)

postgres=# select to_char(now(),'YYYY-mm-dd HH24:MM:ss');
       to_char
---------------------
 2008-09-24 14:09:20
(1 row)
Sign up to request clarification or add additional context in comments.

Comments

4

I think this is what your're searching for:

timestamp [ (p) ] [ without time zone ] or timestamp [ (p) ] with time zone

otherwise have a look @ http://www.postgresql.org/docs/8.1/interactive/datatype-datetime.html

Comments

2

OK, thanks for the answers, they helped point me in the right direction. What I actually was looking for was to_timestamp.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.