oracle unix时间戳与date转换
create or replace function unix_to_oracle(in_number number) return date is
begin
return (to_date('','yyyymmdd') + in_number/86400
+ to_number(substr(tz_offset(sessiontimezone),1,3))/24); end unix_to_oracle;
select unix_to_oracle(1509490525) from dual;

create or replace function oracle_to_unix(in_date in date) return number is
begin
return ((in_date-to_date('','yyyymmdd'))*86400 -
to_number(substr(tz_offset(sessiontimezone),1,3))*3600);
end oracle_to_unix;
select oracle_to_unix(sysdate) from dual;

oracle unix时间戳与date转换的更多相关文章
- MySql 格式化时间(包括正常时间格式与unix时间戳的互相转换)
函数:FROM_UNIXTIME 作用:将MYSQL中以INT(11)存储的时间以"YYYY-MM-DD"格式来显示.语法:FROM_UNIXTIME(unix_timestamp ...
- oracle将unix 时间戳转换为date类型
select to_date('19700101','yyyyMMdd')+numtodsinterval(8*3600,'second')+numtodsinterval(60,'second') ...
- c# datetime与 timeStamp(unix时间戳) 互相转换
/// <summary> /// Unix时间戳转为C#格式时间 /// </summary> /// <param name="timeStamp" ...
- java 时间戳与date转换
1.时间戳转换为date long sjc=1442633777; SimpleDateFormat t = new SimpleDateFormat("yyyyMMddHHmmss&quo ...
- oracle中时间戳转为Date类型的数据
问题描述: 一个表中原本应该存放date类型的数据,但是不知道之前哪位大仙把两个字段的类型建成了NUMBER类型的了,这样在后台看时间肯定不方便.现在需要改成date类型,但是现在库中是有数据的,不能 ...
- MySQL(Unix时间戳、日期)转换函数
unix_timestamp() mysql> select unix_timestamp(); +------------------+ | unix_timestamp() | +----- ...
- Oracle视图时间戳转为Date
CREATE OR REPLACE VIEW PDAORDER AS SELECT po.id id, po.order_no AS order_no, po.money AS money, (SEL ...
- oracle 根据时间戳查询date类型sql
话不多说上sql: select to_char(1574837126879/(1000*60*60*24)+to_date('1970-01-01 08:00:00','YYYY-MM-DD HH2 ...
- 将Unix时间戳转换为Date、Json属性动态生成反序列化、序列化指定属性
实体类 public class Test { [JsonIgnore] public string GetDate { get { return GetTime.ToString("yyy ...
随机推荐
- CentOS 查看是否安装软件包
1. rpm包安装的,可以用rpm -qa看到,如果要查找某软件包是否安装,用 rpm -qa | grep "软件或者包的名字" 2. deb包安装的,可以用dpkg -l能看到 ...
- 【转】chrome devtools protocol——Web 性能自动化
前言 在测试Web页面加载时间时,可能会是这样的: 打开chrome浏览器. 按F12打开开发者工具. 在浏览器上打开要测试的页面 查看开发者工具中Network面板的页面性能数据并记录 或者在开发者 ...
- TCL脚本语言基础介绍
Tcl简介(一):Tcl 语法 Tcl 语法 Tcl是一种很通用的脚本语言,它几乎在所有的平台上都可以释运行,其强大的功能和简单精妙的语法会使你感到由衷的喜悦,这片文章对 Tcl有很好的描述和说明.如 ...
- 189. Rotate Array(Array)
Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array ...
- OSPF网络类型不一致路由无法计算的问题
晚上割接,远端的ASR9001-s网络类型为广播类型,本端为6509-e,网络接口类型修改成p2p后,OSPF邻居关系建立,但是路由无法计算.
- Codeforces Round #518 (Div. 2) [Thanks, Mail.Ru!]
Codeforces Round #518 (Div. 2) [Thanks, Mail.Ru!] https://codeforces.com/contest/1068 A #include< ...
- 使用vue-cli快速搭建大型单页应用
前言: 经过一段时间angular的洗礼之后 ,还是决定回归Vue.现就vue安装.工程搭建.常用依赖安装直至开发挣个流程做一整理,希望对初学者有所帮助. 前提条件: 对 Node.js 和相关构建工 ...
- Linux系统(Centos)下安装nodejs并配置环境
总结Centos下安装nodejs并配置环境,记录成功安装的方法.推荐的安装方法是利用已编译的二进制文件安装,不推荐使用源码的形式安装,一是源码安装比较麻烦,二是需要自行下载编译浪费时间. 1.安装n ...
- [leetcode]128. Longest Consecutive Sequence最长连续序列
Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Y ...
- Selenium + Python + Firefox
按网上教程搭建好环境后,执行下面的代码出现了错误: 测试代码如下: from selenium import webdriver driver=webdriver.Firefox() driver.g ...