MySQL和PostgreSQL日期格式化

MySQL:

select DATE_FORMAT(CURRENT_TIMESTAMP,'%Y-%m-%d %H:%i:%s') AS col1,CURRENT_TIMESTAMP as col2

 PostgreSQL:

select to_char(CURRENT_TIMESTAMP,'yyyy-mm-dd hh24:mi:ss') AS col1,CURRENT_TIMESTAMP as col2

 例:

select to_char(CURRENT_TIMESTAMP,'yyyy-MM') AS col1,CURRENT_TIMESTAMP as col2

相关推荐