10种数据库获取当前时间/服务器时间

180it 2021-04-08 PM 1266℃ 0条

10种数据库获取当前时间/服务器时间(Oracle、Infomix、DB2、SQL Server、Access 、Sybase、MySQL、FoxPro、Sqlite、postgreSQL)

1、Oracle数据库:select sysdate from Table1;

2、Infomix数据库:select current from sysmaster:sysshmvals;

3、DB2数据库:select current timestamp from sysibm.sysdummy1

4、SQL Server数据库:select getdate();

5、Access 数据库:select * from table1 where Date=" & date()

6、Sybase数据库:select getdate();

7、MySQL数据库:select sysdate(); //等同 select now() --yyyy-MM-dd HH:mm:ss select current_date --yyyy-MM-dd

8、FoxPro数据库:select date();

9、Sqlite数据库:select 1 或 select (datetime('now')) //select strftime('%Y-%m-%d %H:%M:%f','now') 精确到毫秒,select strftime('%s','now') 时间戳

10、postgreSQL数据库:select sysdate();

支付宝打赏支付宝打赏 微信打赏微信打赏

如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!

标签: none

10种数据库获取当前时间/服务器时间