How do I convert date in Netezza to yyyymmdd from timestamp format?
For example: to_date('31 Dec 2015','DD Mon YYYY') returns 2015-12-31. to_date('31 Dec 2015','DD Mon YYYY') returns 2015-12-31. to_date('31 Dec 2015','DD Mon YYYY') returns 2015-12-31.
You can simply use the fromtimestamp function from the DateTime module to get a date from a UNIX timestamp. This function takes the timestamp as input and returns the corresponding DateTime object to timestamp.
Use DATE() function to get the date in mm/dd/yyyy format. Eg: select * from tablename where DATE(timestamp column) = some date; will do... show you what you want? Select date (timestampfield) from table.
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')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With