mysql datetime当前,如何获取当前datetime在SQL?

Want to get current datetime to insert into lastModifiedTime column. I am using MySQL database. My questions are:

is there a function available in SQL? or

it is implementation depended so each database has its own function for this?

what is the function available in MySQL?

解决方案

Complete answer:

1. Is there a function available in SQL?

Yes, the SQL 92 spec, Oct 97, pg. 171, section 6.16 specifies this functions:

CURRENT_TIME Time of day at moment of evaluation

CURRENT_DATE Date at moment of evaluation

CURRENT_TIMESTAMP Date & Time at moment of evaluation

2. It is implementation depended so each database has its own function for this?

Each database has its own implementations, but they have to implement the three function above if they comply with the SQL 92 specification (but depends on the version of the spec)

3. What is the function available in MySQL?

NOW() returns 2009-08-05 15:13:00

CURDATE() returns 2009-08-05

CURTIME() returns 15:13:00

(As SixFootTallRabbit says)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值