Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

netezza

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

like image 275
Ntiyiso Mbhalati Avatar asked Jun 30 '10 12:06

Ntiyiso Mbhalati


People also ask

How do I change the date format in Netezza?

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.

How do I turn a timestamp into a date?

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.

How do I convert a timestamp to a date in SQL?

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.


1 Answers

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')
like image 145
user447151 Avatar answered Oct 05 '22 08:10

user447151