mysql日期和字符相互转换方法
date_format(date,'%Y-%m-%d') -------------->oracle中的to_char();
str_to_date(date,'%Y-%m-%d') -------------->oracle中的to_date();
%Y:代表
4
位的年份
%y:代表
2
为的年份
%m:代表月, 格式为(
01
……
12
)
%c:代表月, 格式为(
1
……
12
)
%d:代表月份中的天数,格式为(
00
……
31
)
%e:代表月份中的天数, 格式为(
0
……
31
)
%H:代表小时,格式为(
00
……
23
)
%k:代表 小时,格式为(
0
……
23
)
%h:代表小时,格式为(
01
……
12
)
%I:代表小时,格式为(
01
……
12
)
%l:代表小时,格式为(
1
……
12
)
%i:代表分钟, 格式为(
00
……
59
)
%r:代表 时间,格式为
12
小时(hh:mm:ss [AP]M)
%T:代表 时间,格式为
24
小时(hh:mm:ss)
%S:代表 秒,格式为(
00
……
59
)
%s:代表 秒,格式为(
00
……
59
)
以上就是mysql相似于oracle的to_char() to_date()方法的详细内容,更多关于mysql相似于oracle的to_char() to_date()方法的资料请关注九品源码其它相关文章!