joe*_*joe 4 oracle date-format date
这个查询:
select to_char(sysdate, 'Ddspth MONTH, Yyyysp') from dual
Run Code Online (Sandbox Code Playgroud)
将返回:
Eighteenth MARCH , Two Thousand Fourteen
Run Code Online (Sandbox Code Playgroud)
我想知道是否有任何其他格式关键字允许包含诸如 "of" 、 "the" 之类的字符列表,以便获得如下输出:
"Today is the" Eighteenth "of" MARCH, Two Thousand Fourteen
Run Code Online (Sandbox Code Playgroud)
还是需要拆分日期转换并使用 concat 函数?谢谢
例如 :
select 'Today is the ' || to_char(sysdate, 'Ddspth') || ' of' || to_char(sysdate,' MONTH, Yyyysp') from dual
Run Code Online (Sandbox Code Playgroud)
想通了,这里有一个解决方案,以防有人需要做类似的事情......
在字符周围使用双引号 "" 将按原样显示它们...
select to_char(sysdate,'"Today is the" Ddspth "of" fmMONTH,Yyyysp') as Today from dual
Run Code Online (Sandbox Code Playgroud)
将显示:
"Today is the" Eighteenth "of" MARCH, Two Thousand Fourteen
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
965 次 |
最近记录: |