Getting error function to_date(timestamp without time zone, unknown) does not exist

103,191

Solution 1

It seems like all it needs is a conversion from timestamp to text as function definition is: to_date(text,text).

Perhaps in 8.2 this conversion from timestamp to text was already predefined.

http://www.postgresql.org/docs/8.4/static/functions-formatting.html

Solution 2

Three year later. You can cast

SELECT
    to_date(cast(createddate as TEXT),'YYYY-MM-DD') 
FROM  
    product_trainings;

Solution 3

And even neater:

SELECT to_date(createddate::TEXT,'YYYY-MM-DD') 
FROM product_trainings;
Share:
103,191

Related videos on Youtube

Surya Prakash Tumma
Author by

Surya Prakash Tumma

Updated on July 09, 2022

Comments

  • Surya Prakash Tumma
    Surya Prakash Tumma almost 2 years

    Recently i have migrated my postgres from 8.2 to 8.4. when I run my application and tried to login i am getting these error

     ERROR [JDBCExceptionReporter] ERROR: function to_date(timestamp without time zone, unknown) does not exist
    

    i had checked in my postgres by excecuting these to_date function

    SELECT  to_date(createddate,'YYYY-MM-DD') FROM  product_trainings;
    

    it is giving me error function to_date does not exist

    when i execute the same query in postgres 8.2 i am not getting error

    Please help me to resolve these issue.