postgresql随笔


1.日期加减天数计算

cast(cast(b.f_date as text) as date )+ 365


2.本机安装postresql用户名密码

用户名:postgres

密码:postgres

数据库:postgres


3.两个日期计算

select date'20170302' - date'20170228'

4.

select to_char(current_date,'yyyymmdd');--date 转 text
select to_char(current_date - 1,'yyyymmdd');--date 转 text
select cast(to_char(current_date - 1,'yyyymmdd') as int);--date转ext,再转integer


5.10 * * * * cd /home/xx/xx/xx && python zzz.py > log.txt 2>&1


6.MysqL中当前日期 select date_format(Now(),'%Y%m%d') ;其中%Y表示4位年数,%y表示两位年数

前一天为DATE_SUB(date_format(Now(),'%Y%m%d'),INTERVAL 1 day)

postgredql中 cast(to_char(current_date - 1,'yyyymmdd') as int)

相关文章

项目需要,有个数据需要导入,拿到手一开始以为是mysql,结果...
本文小编为大家详细介绍“怎么查看PostgreSQL数据库中所有表...
错误现象问题原因这是在远程连接时pg_hba.conf文件没有配置正...
因本地资源有限,在公共测试环境搭建了PGsql环境,从数据库本...
wamp 环境 这个提示就是说你的版本低于10了。 先打印ph...
psycopg2.OperationalError: SSL SYSCALL error: EOF detect...