签到成功

知道了

CNDBA社区CNDBA社区

Oracle与Mysql时间对比

2021-11-29 22:23 1191 0 原创 mysql
作者: hbhe0316

1.查看当前系统日期

http://www.cndba.cn/hbhe0316/article/22649
http://www.cndba.cn/hbhe0316/article/22649
http://www.cndba.cn/hbhe0316/article/22649

SQL> select to_char(sysdate, 'yyyy-mm-dd') from dual;

TO_CHAR(SYSDATE,'YYYY-MM-DD')
------------------------------
2021-11-29

mysql> select curdate();
+------------+
| curdate()  |
+------------+
| 2021-11-29 |
+------------+
1 row in set (0.00 sec)

2.查看当前时间时间

http://www.cndba.cn/hbhe0316/article/22649
http://www.cndba.cn/hbhe0316/article/22649
http://www.cndba.cn/hbhe0316/article/22649

SQL> select to_char(sysdate, 'hh24:mi:ss') from dual;

TO_CHAR(SYSDATE,'HH24:MI
------------------------
22:15:10

mysql> select current_time;
+--------------+
| current_time |
+--------------+
| 22:16:19     |
+--------------+
1 row in set (0.00 sec)

3.查询系统日期和时间:

http://www.cndba.cn/hbhe0316/article/22649
http://www.cndba.cn/hbhe0316/article/22649
http://www.cndba.cn/hbhe0316/article/22649http://www.cndba.cn/hbhe0316/article/22649

SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;

TO_CHAR(SYSDATE,'YYYY-MM-DDHH24:MI:SS')
---------------------------------------------------------
2021-11-29 22:19:46

mysql> select now();
+---------------------+
| now()               |
+---------------------+
| 2021-11-29 22:20:08 |
+---------------------+
1 row in set (0.00 sec)

mysql> select sysdate();
+---------------------+
| sysdate()           |
+---------------------+
| 2021-11-29 22:20:17 |
+---------------------+
1 row in set (0.00 sec)

4.时间戳


SQL> select systimestamp from dual;

SYSTIMESTAMP
---------------------------------------------------------------------------
29-NOV-21 10.20.53.696960 PM +08:00

mysql> select current_timestamp;
+---------------------+
| current_timestamp   |
+---------------------+
| 2021-11-29 22:21:27 |
+---------------------+
1 row in set (0.00 sec)

版权声明:本文为博主原创文章,未经博主允许不得转载。

MYSQL

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
hbhe0316

hbhe0316

关注

1.只有承认无知,才能装下新的东西; 2.进步来自一点点滴滴的积累; 3.广博让你更优秀,而专业让你无法替代; 4.挫折和失败能够转换为一种财富。

  • 889
    原创
  • 1
    翻译
  • 13
    转载
  • 24
    评论
  • 访问:2817418次
  • 积分:1523
  • 等级:核心会员
  • 排名:第6名
精华文章
    热门文章
      Copyright © 2016 All Rights Reserved. Powered by CNDBA · 皖ICP备2022006297号-1·

      AI QQ群