How do I convert date in Netezza to yyyymmdd from timestamp format?

Ntiyiso Mbhalati picture Ntiyiso Mbhalati · Jun 30, 2010 · Viewed 89.6k times · Source

How do I convert date in Netezza to yyyymmdd from timestamp format?

Answer

user447151 picture user447151 · Sep 14, 2010

Use the below queries to convert to date format.

select TO_CHAR( DATE '2009-12-23 23:45:58','YYYY-MM-DD')

or

select TO_CHAR(TO_DATE( '2009-12-23 23:45:58','YYYY-MM-DD HH24:MI:SS'),'YYYY-MM-DD')

or

select TO_CHAR(current_timestamp,'YYYY-MM-DD')