加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

postgresql随笔

发布时间:2020-12-13 16:54:39 所属栏目:百科 来源:网络整理
导读: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


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)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读