oracle 时间显示

来源:百度知道 编辑:UC知道 时间:2024/05/22 01:17:31
我有一个表 TEMP ,有一列 叫 DONE_date 里边的数据是 2008-8-6 上午 11:28:35 这样的,我想让它只显示 年月 要怎么做?

select to_char(DONE_date,'yyyy-mm-dd hh24:mi:ss') from TEMP

to_char是把日期型的数据转化为字符型的数据的一个函数
其中yyyy是年,mm是月份。dd是日,hh24是按24小时显示 mi是分钟,ss是秒,这个都是时间函数里的东西,自己按你要求再改吧

select to_char(DONE_date,'YYYY')||'年'||to_char(DONE_date,'MM')||'月' from TEMP