oracle 时间函数to_date

TO_DATE Format Masks
FormatReturns
DDay of the week
DDDay of the month
DDDNumerical day of the year, 1 ~ 365 (366 for Leap years)
DAYFull textual representation of the day, i.e. "Monday", "Tuesday", "Wednesday"
DYDay in three letters, i.e. "MON", "TUE", "FRI"
WWeek of the month
WWWeek of the year
MMMonth in two digits, i.e. 01 = Jan, 02 = Feb,...12 = -Dec
MONMonth in three characters, i.e. "Jan", "Feb", "Apr"
MONTHFull textual representation of the Month, i.e. "January", "February", "April"
RMMonth in Roman Characters (I-XII, I-Jan, II-Feb, ... XII-Dec)
QQuarter of the Month
YYLast two digits of the year.
YYYYFull year
YEARYear in words like "Nineteen Eighty Seven"
HHHours in 12 hour format
HH12Hours in 12 hour format
HH24Hours in 24 hour format ("military time")
MIMinutes
SSSeconds
FFFractional Seconds
SSSSSMilliseconds
JJulian Day i.e Days since 1st-Jan-4712BC to till-date
RRIf the year is less than 50 then Oracle considers the year as a 21st century date. If the year is greater than 50 then Oracle considers the year to be in the 20th century.

字符串转变成date


SQL> SELECT TO_DATE('2014-4-10 14:10:00', 'YYYY-MM-DD HH24:MI:SS') FROM DUAL;
 
TO_DATE('2014-4-1014:10:00','Y
------------------------------
2014-4-10 14:10:00
 

获得当前时间


SQL> SELECT SYSDATE FROM DUAL;
 
SYSDATE
------------------------------
2014-4-10 10:28:33


格式化时间


SQL> SELECT TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI:SS') FROM DUAL;
 
TO_CHAR(SYSDATE,'YYYY-MM-DDHH2
------------------------------
2014-04-10 10:22:43
 
SQL> 

12小时制


SQL> SELECT TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI:SS') FROM DUAL;
 
TO_CHAR(SYSDATE,'YYYY-MM-DDHH2
------------------------------
2014-04-10 13:24:03
 
SQL> SELECT TO_CHAR(SYSDATE, 'YYYY-MM-DD HH:MI:SS') FROM DUAL;
 
TO_CHAR(SYSDATE,'YYYY-MM-DDHH:
------------------------------
2014-04-10 01:24:06
 
SQL> 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值