ORACLE拼日期

Oracle數據庫拼字符串是用"||"鏈接的。在開發中,常常會用到時間範圍的查詢 例如  startTime >='2017-05-22 00:00:00' and endTime <='2017-05-22 23:59:59'sql

SELECT  to_date(to_char(sysdate - 1, 'YYYY-MM-DD') || ' 00:00:00', 'YYYY-MM-DD hh24:mi:ss') as "START_TIME" from dual;

結果:數據庫

START_TIMEspa

--------------------------blog

2017-05-21 00:00:00開發

 

 

SELECT to_date(to_char(sysdate - 1, 'YYYY-MM-DD') || ' 23:59:59', 'YYYY-MM-DD hh24:mi:ss') as "END_TIME"  from dual;

結果:字符串

END_TIMEclass

--------------------------date

2017-05-21 23:59:59im

相關文章
相關標籤/搜索