TO_CHAR()
在Oracle中,TO_CHAR()函数用于将数字或日期转换为字符串,通常会使用特定的格式。
格式
TO_CHAR(x,[format])
| Parameter | Definition |
| x | the number/date that will be converted to a char/string |
| format | optional, is the format that will be used to convert x to a char/string |
样例
1.将日期转换为字符串
to_char()函数常用于将date或timestamp类型的值按照指定格式转换为字符串
select to_char(sysdate,'YYYY-MM-DD') from dual

2.将日期和时间转换为字符串
select to_char(sysdate,'YYYY


2302

被折叠的 条评论
为什么被折叠?



