Reputation: 2193
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.
Upvotes: 35
Views: 170536
Reputation: 19880
And even neater:
SELECT to_date(createddate::TEXT,'YYYY-MM-DD')
FROM product_trainings;
Upvotes: 21
Reputation: 451
Three year later. You can cast
SELECT
to_date(cast(createddate as TEXT),'YYYY-MM-DD')
FROM
product_trainings;
Upvotes: 45
Reputation: 2011
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
Upvotes: 12