一、SQL
ISNULL(字段名,替换值)
SUBSTRING(字段名,起始位置,截取长度)
GETDATE()
YEAR(GETDATE())
MONTH(GETDATE())
DAY(GETDATE())
SELECT DATEPART(HOUR,GETDATE())
SELECT DATEPART(MINUTE,GETDATE())
SELECT DATEPART(SECOND,GETDATE())
+ (连接符号)
'2013-03-29 11:40:28'
二、Oracle
NVL(字段名,替换值)
SUBSTR(字段名,起始位置,截取长度)
SELECT SYSDATE FROM DUAL
SELECT TO_CHAR(SYSDATE,'yyyy') FROM DUAL
SELECT TO_CHAR(SYSDATE,'MM') FROM DUAL
SELECT TO_CHAR(SYSDATE,'dd') FROM DUAL
SELECT TO_CHAR(SYSDATE,'hh') FROM DUAL
SELECT TO_CHAR(SYSDATE,'mi') FROM DUAL
SELECT TO_CHAR(SYSDATE,'ss') FROM DUAL
||
TO_DATE('2013-03-29 11:40:28','yyyy/MM/dd hh:mi:ss')
原帖地址:http://blog.csdn.net/taomanman/article/details/8735698
时间: 2024-12-25 15:50:30