PostgreSQL字符日期和UNIX时间戳转换
发布时间:2020-12-13 18:22:24 所属栏目:百科 来源:网络整理
导读:一、日期格式转换 1.字符日期格式转化为UNIX时间戳格式 字段endtime为内容为UNIX时间戳格式,例如1346650755 select * fromtest where endtime = extract(epoch FROM date('2012-09-03 00:00:00')); 2.UNIX时间戳转化为字符日期格式 select * fromtest where
一、日期格式转换 1.字符日期格式转化为UNIX时间戳格式 字段endtime为内容为UNIX时间戳格式,例如1346650755 select * fromtest where endtime >= extract(epoch FROM date('2012-09-03 00:00:00')); 2.UNIX时间戳转化为字符日期格式 select * fromtest where date(to_timestamp(endtime))>='2012-09-02'; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |