2012-04-09 46 views
0

我需要在不同的列中分隔時間部分和日期部分。如何從sybase的日期時間列中單獨選擇日期部分和時間部分?選擇時間部分

For eg: 

My Column has 09-04-2012 10:46:09 

i need "09-04-2012" and "10:46:09" 

sybase中怎麼可能?

+0

[檢查此鏈接](http://infocenter.sybase.com/help /index.jsp?topic=/com.sybase.help.ase_15.0.blocks/html/blocks/blocks36.htm) – Ghostman 2012-04-09 05:24:32

回答

1

選擇從轉換片(CHAR(10),穗軸,23)

會給你YYY-MM-DD

1

不知道多少的Sybase的,但這應該工作:

select dateformat(column, 'DD-MM-YYYY'), dateformat(column, 'hh:mm:ss') from tab 
1

Firends,我找到了解決辦法..

感謝Mostacho,

其實我與SqlDBBox檢查工具..所以dateformat方法不支持。所以我使用follwing轉換方法..它的Wrking罰款。

select convert(char(8),getdate(),8) 

select convert(char(8),getdate(),5) 

這是給我所需的輸出。