
2008-5-24 10:29
linkadmin
oracle 中number转日期的问题
请教,如何将number类型的1211584317 变2008-5-24 7:11:57的效果的 试了半天了 搞不定啊 谢谢
2008-5-24 10:43
nokiabc
数据类型转换函数
字符串转时间
to_date('2007-04-26 08:08:08','YYYY-MM-DD HH24:MI:SS')
2008-5-24 10:48
sdxiong
试了一下,是在1970-01-01 08:00:00之上加上1211584317 秒,就可以得到 2008-5-24 7:11:57
2008-5-24 10:49
microsoft_fly
create or replace function num_to_date(in_number NUMBER) return date is
begin
return(TO_DATE('19700101','yyyymmdd') + in_number/86400 +TO_NUMBER(SUBSTR(TZ_OFFSET(sessiontimezone),1,3))/24);
end num_to_date;
2008-5-24 12:15
wangfans
[quote]原帖由 [i]sdxiong[/i] 于 2008-5-24 10:48 发表 [url=http://www.itpub.net/redirect.php?goto=findpost&pid=10465266&ptid=993971][img]http://www.itpub.net/images/common/back.gif[/img][/url]
试了一下,是在1970-01-01 08:00:00之上加上1211584317 秒,就可以得到 2008-5-24 7:11:57 [/quote]
:right:
2008-5-24 13:26
jvkojvko
高!
2008-5-24 13:28
linkadmin
回复 #2 nokiabc 的帖子
谢谢!!!!
2008-5-24 18:16
xinzaitian
:right:
2008-5-24 18:19
DragonBill
[quote]原帖由 [i]sdxiong[/i] 于 2008-5-24 10:48 发表 [url=http://www.itpub.net/redirect.php?goto=findpost&pid=10465266&ptid=993971][img]http://www.itpub.net/images/common/back.gif[/img][/url]
试了一下,是在1970-01-01 08:00:00之上加上1211584317 秒,就可以得到 2008-5-24 7:11:57 [/quote]
:right:
不开直升飞机了改耍猴了?? :)
2008-5-24 18:29
xiaodong_1567
[quote]原帖由 [i]sdxiong[/i] 于 2008-5-24 10:48 发表 [url=http://www.itpub.net/redirect.php?goto=findpost&pid=10465266&ptid=993971][img]http://www.itpub.net/images/common/back.gif[/img][/url]
试了一下,是在1970-01-01 08:00:00之上加上1211584317 秒,就可以得到 2008-5-24 7:11:57 [/quote]
怎么算得
挺麻烦的吧
2008-5-24 18:50
谁
[quote]原帖由 [i]xiaodong_1567[/i] 于 2008-5-24 18:29 发表 [url=http://www.itpub.net/redirect.php?goto=findpost&pid=10468948&ptid=993971][img]http://www.itpub.net/images/common/back.gif[/img][/url]
怎么算得
挺麻烦的吧 [/quote]
1、 倒推,做减法
2、1970-01-01本来就是计算机计算日历的起始时间
2008-5-24 22:56
7854236
学了一招,呵呵
2008-5-26 13:40
haibo_li
学习了
2008-5-26 14:38
king140445
学习
2008-5-26 14:46
jiqing1004
:rose:
学习了
2008-7-4 01:58
lctweb
time_t整数时间-->描述转换
转换时间NUM_TO_DATE()
select to_char(num_to_date(1211584317),'yyyy-mm-dd hh24:mi:ss') from dual;
TO_CHAR(NUM_TO_DATE
-------------------
2008-05-24 07:11:57
描述时间-->time_t整数时间转换
转换数据DATE_TO_NUM()
select date_to_num(to_date('2008 05-24 07:11:57','yyyy-mm-dd hh24:mi:ss')) from dual;
DATE_TO_NUM(TO_DATE('200805-2407:11:57','YYYY-MM-DDHH24:MI:SS'))
----------------------------------------------------------------
1211584317
2008-7-4 10:02
feng2371
num_to_date?
2008-7-4 10:20
yuchangle
num_to_date 是他自己定义的,在前面有
2008-7-5 10:56
lctweb
function date_to_num(s in date) return float
is
begin
return (s-to_date('1970-01-01 08:00:00','YYYY-MM-DD HH24:MI:SS'))*86400;
end;
2008-7-5 11:03
lctweb
function num_to_date(s in number) return date
is
begin
return to_date('1970-01-01 08:00:00','YYYY-MM-DD HH24:MI:SS')+(s /86400);
end;
页:
[1]

Powered by ITPUB论坛