Skip to content

系统时间函数

PostgreSQL数据库中获取系统时间的函数如下,其中“precision”为秒的标度,“timeofday”为text格式的应用显示时间。

  • CURRENT_DATE
  • CURRENT_TIME
  • CURRENT_TIMESTAMP
  • CURRENT_TIME(precision)
  • CURRENT_TIMESTAMP(precision)
  • LOCALTIME
  • LOCALTIMESTAMP
  • LOCALTIME(precision)
  • LOCALTIMESTAMP(precision)
  • transaction_timestamp()
  • statement_timestamp()
  • clock_timestamp()
  • timeofday()
  • now()
虚谷数据库中对应的系统时间函数为“current_timestamp”、“sysdate”。
  • PostgreSQL系统时间函数(部分示例)
    SQL> select current_timestamp as systemtime;
    SQL> select localtime as systemtime;
    SQL> select localtimestamp as systemtime;
    systemtime         |
    -------------------+
    2022-07-28 03:14:53|
  • Xugu系统时间函数
    SQL> select current_timestamp as systemtime from dual;
    SQL> select sysdate() as systemtime from dual;
    systemtime         |
    -------------------+
    2022-07-28 03:14:53|