150bryant Posted January 10, 2013 Report Posted January 10, 2013 bro the Char(Date_col, Local) works for me. you wan the date format of yyyy-mm-dd to mm-dd-yyyy the mm-dd-yyyy is US format..which is local. so the Char (date,local) will convert the date to local(US) format.
150bryant Posted January 10, 2013 Report Posted January 10, 2013 you can do... select date_col, char(date_col,Local) from TABLE. to make sure.
150bryant Posted January 10, 2013 Report Posted January 10, 2013 arey oo samba...reply istey intiki veltha inka.. 5 aindhi ikkada
qwerty1204 Posted January 10, 2013 Author Report Posted January 10, 2013 I am running in DB2 control center and none of the above isnt wrkng to be precise my column in the table is of type TIMESTAMP (for example the data in the column in this format 2013-01-08 10:46:07.0) My query result should be like this: 01-08-2013
kranthi111 Posted January 10, 2013 Report Posted January 10, 2013 [quote name='arey ooo samba' timestamp='1357855175' post='1303087509'] I am running in DB2 control center and none of the above isnt wrkng to be precise my column in the table is of type TIMESTAMP (for example the data in the column in this format 2013-01-08 10:46:07.0) My query result should be like this: 01-08-2013 [/quote] Idhi work avthundhi kadha sql lo.. select CONVERT(VARCHAR(19),GETDATE(),110)
150bryant Posted January 10, 2013 Report Posted January 10, 2013 Try tht SELECT TO_DATE (TO_CHAR (SYSTIMESTAMP, 'YYYY-MON-DD HH24:MI:SS'), 'YYYY-MON-DD HH24:MI:SS' ) AS my_date FROM DUAL
Nisacharudu Posted January 10, 2013 Report Posted January 10, 2013 [quote name='arey ooo samba' timestamp='1357855175' post='1303087509'] I am running in DB2 control center and none of the above isnt wrkng to be precise my column in the table is of type TIMESTAMP (for example the data in the column in this format 2013-01-08 10:46:07.0) My query result should be like this: 01-08-2013 [/quote] nuvvu emi tool use sestunnavu? paina cheppena vanni work avutai kani cmd prompt lo nee tool malli tool lo unna settings ke data convert chesukuntundi
150bryant Posted January 10, 2013 Report Posted January 10, 2013 some more steps to do it [color=#333333][font=Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif][size=3] [indent] [size=3][background=rgb(242, 246, 248)] [font=monospace] SQL[color=#66CC66]>[/color] [color=#993333][b]SELECT[/b][/color] SYSDATE DT [color=#993333][b]FROM[/b][/color] DUAL ; DT [color=#808080][i]---------[/i][/color] 08[color=#66CC66]-[/color]APR[color=#66CC66]-[/color]09 SQL[color=#66CC66]>[/color] [color=#993333][b]SELECT[/b][/color] SYSTIMESTAMP TS [color=#993333][b]FROM[/b][/color] DUAL; TS [color=#808080][i]---------------------------------------------------------------------------[/i][/color] 08[color=#66CC66]-[/color]APR[color=#66CC66]-[/color]09 09[color=#66CC66].[/color]50[color=#66CC66].[/color]08[color=#66CC66].[/color]118526 AM [color=#66CC66]+[/color]05:[color=#CC66CC]30[/color] SQL[color=#66CC66]>[/color] [color=#993333][b]SELECT[/b][/color] [color=#993333][b]CAST[/b][/color][color=#66CC66]([/color]SYSTIMESTAMP [color=#993333][b]AS[/b][/color] [color=#993333][b]DATE[/b][/color][color=#66CC66])[/color] DT [color=#993333][b]FROM[/b][/color] DUAL; DT [color=#808080][i]---------[/i][/color] 08[color=#66CC66]-[/color]APR[color=#66CC66]-[/color]09 SQL[color=#66CC66]>[/color] [color=#993333][b]SELECT[/b][/color] TRUNC[color=#66CC66]([/color]SYSTIMESTAMP[color=#66CC66])[/color] DT [color=#993333][b]FROM[/b][/color] DUAL; DT [color=#808080][i]---------[/i][/color] 08[color=#66CC66]-[/color]APR[color=#66CC66]-[/color]09 SQL[color=#66CC66]>[/color][/font][/background][/size][/indent][/size][/font][/color]
150bryant Posted January 10, 2013 Report Posted January 10, 2013 http://www.club-oracle.com/forums/convert-oracle-timestamp-to-date-t692/
deals2buy Posted January 14, 2013 Report Posted January 14, 2013 jamajacha arey o samba..paina cheppinattu work avvaleda? [quote name='Desamudhuru' timestamp='1357854358' post='1303087393'] convert(varchar(10), columnname,101) it will work i'm using this. [/quote] [quote name='Jeedeelu' timestamp='1357854383' post='1303087400'] nuvu adigina format number.. 101 [/quote] meeriddaru cheppindi SQL server lo kada work ayyedi [quote name='Alexander' timestamp='1357854710' post='1303087447'] cheppaka pothey em chesthav [/quote][img]http://lh3.ggpht.com/--o7mXz3u-j4/T9VVBGzBJAI/AAAAAAAAGo0/kmj8a1-XW2g/s150/PK-1.gif[/img]
qwerty1204 Posted January 14, 2013 Author Report Posted January 14, 2013 [quote name='Kaarthikeya' timestamp='1358205396' post='1303108246'] jamajacha arey o samba..paina cheppinattu work avvaleda? meeriddaru cheppindi SQL server lo kada work ayyedi [img]http://lh3.ggpht.com/--o7mXz3u-j4/T9VVBGzBJAI/AAAAAAAAGo0/kmj8a1-XW2g/s150/PK-1.gif[/img] [/quote] nenu DB2 databse using baa...control center is the GUI for accessing DB2 table...nenu meeru andahru chepinda queries akakda run chesanu..I didn't get the result
deals2buy Posted January 14, 2013 Report Posted January 14, 2013 [quote name='arey ooo samba' timestamp='1358206135' post='1303108281'] nenu DB2 databse using baa...control center is the GUI for accessing DB2 table...nenu meeru andahru chepinda queries akakda run chesanu..I didn't get the result [/quote] DB2 database gurinchi antha idea ledu but with the knowledge I have paina cheppina TO_CHAR anedi work avutunde
anandam2012 Posted January 14, 2013 Report Posted January 14, 2013 [quote name='arey ooo samba' timestamp='1357854041' post='1303087342'] I have a Date column in a table in this format YYYY-MM-DD while querying from that table and displaying the result in the output, I need to show it in this format: MM-DD-YYYY how can it be done in the SQL query?? [/quote]try this one...it should work....select to_char(date,'mm-dd-yyyy') from table
qwerty1204 Posted January 16, 2013 Author Report Posted January 16, 2013 [quote name='anandam2012' timestamp='1358207561' post='1303108391'] try this one...it should work....select to_char(date,'mm-dd-yyyy') from table [/quote] this works baa..thanx
anandam2012 Posted January 16, 2013 Report Posted January 16, 2013 [quote name='arey ooo samba' timestamp='1358370537' post='1303119289'] this works baa..thanx [/quote]good good...You are welcome baa...
Recommended Posts