What is PostgreSQL equivalent of SYSDATE from Oracle?

前端 未结 4 988
梦如初夏
梦如初夏 2021-02-04 23:01

I want to perform a query using sysdate like:

select up_time from exam where up_time like sysdate

which is possible in Oracle.

However,

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-04 23:47

    The following functions are available to obtain the current date and/or time in PostgreSQL:

    CURRENT_TIME
    
    CURRENT_DATE
    
    CURRENT_TIMESTAMP
    

    Example

    SELECT CURRENT_TIME;
    08:05:18.864750+05:30
    
    SELECT CURRENT_DATE;
    2020-05-14
    
    SELECT CURRENT_TIMESTAMP;
    2020-05-14 08:04:51.290498+05:30
    

    postgresql docs

提交回复
热议问题