<i id='6Uc09'><tr id='6Uc09'><dt id='6Uc09'><q id='6Uc09'><span id='6Uc09'><b id='6Uc09'><form id='6Uc09'><ins id='6Uc09'></ins><ul id='6Uc09'></ul><sub id='6Uc09'></sub></form><legend id='6Uc09'></legend><bdo id='6Uc09'><pre id='6Uc09'><center id='6Uc09'></center></pre></bdo></b><th id='6Uc09'></th></span></q></dt></tr></i><div id='6Uc09'><tfoot id='6Uc09'></tfoot><dl id='6Uc09'><fieldset id='6Uc09'></fieldset></dl></div>
        • <bdo id='6Uc09'></bdo><ul id='6Uc09'></ul>
      1. <tfoot id='6Uc09'></tfoot>

        <small id='6Uc09'></small><noframes id='6Uc09'>

        <legend id='6Uc09'><style id='6Uc09'><dir id='6Uc09'><q id='6Uc09'></q></dir></style></legend>

        将 Unixtime 转换为日期时间 SQL (Oracle)

        时间:2023-09-20

        <legend id='tlvS7'><style id='tlvS7'><dir id='tlvS7'><q id='tlvS7'></q></dir></style></legend>

            <tbody id='tlvS7'></tbody>
            <i id='tlvS7'><tr id='tlvS7'><dt id='tlvS7'><q id='tlvS7'><span id='tlvS7'><b id='tlvS7'><form id='tlvS7'><ins id='tlvS7'></ins><ul id='tlvS7'></ul><sub id='tlvS7'></sub></form><legend id='tlvS7'></legend><bdo id='tlvS7'><pre id='tlvS7'><center id='tlvS7'></center></pre></bdo></b><th id='tlvS7'></th></span></q></dt></tr></i><div id='tlvS7'><tfoot id='tlvS7'></tfoot><dl id='tlvS7'><fieldset id='tlvS7'></fieldset></dl></div>
            • <bdo id='tlvS7'></bdo><ul id='tlvS7'></ul>

              <small id='tlvS7'></small><noframes id='tlvS7'>

              <tfoot id='tlvS7'></tfoot>
                • 本文介绍了将 Unixtime 转换为日期时间 SQL (Oracle)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个日期时间字段 (P_DT),我想返回 P_DT 大于输入 unix 时间戳的所有结果.

                  I have a datetime field(P_DT) and I would like to return all results where P_DT is greater then an input unix timestamp.

                  Oracle 是否有任何可以提供帮助的内置函数?

                  Does Oracle have any built in functions that can help?

                  在我的搜索中,我找到了 DateTime 到 Unix 的结果,但没有 Unix 到 DateTime...

                  In my searchs I find resuts for DateTime to Unix but no Unix to DateTime...

                  推荐答案

                  没有内置函数.但是写一个相对容易.由于 Unix 时间戳是自 1970 年 1 月 1 日以来的秒数

                  There are no built-in functions. But it's relatively easy to write one. Since a Unix timestamp is the number of seconds since January 1, 1970

                  CREATE OR REPLACE FUNCTION unix_ts_to_date( p_unix_ts IN NUMBER )
                    RETURN DATE
                  IS
                    l_date DATE;
                  BEGIN
                    l_date := date '1970-01-01' + p_unix_ts/60/60/24;
                    RETURN l_date;
                  END;
                  

                  你可以看到被调用

                  SQL> select unix_ts_to_date( 1336822620 ) from dual;
                  
                  UNIX_TS_TO_DATE(133
                  -------------------
                  2012-05-12 11:37:00
                  

                  这篇关于将 Unixtime 转换为日期时间 SQL (Oracle)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:NLS_NUMERIC_CHARACTERS 十进制设置 下一篇:Oracle JDBC 和 Oracle CHAR 数据类型

                  相关文章

                  1. <legend id='cYtN9'><style id='cYtN9'><dir id='cYtN9'><q id='cYtN9'></q></dir></style></legend>
                  2. <small id='cYtN9'></small><noframes id='cYtN9'>

                      <bdo id='cYtN9'></bdo><ul id='cYtN9'></ul>
                    <tfoot id='cYtN9'></tfoot>

                      <i id='cYtN9'><tr id='cYtN9'><dt id='cYtN9'><q id='cYtN9'><span id='cYtN9'><b id='cYtN9'><form id='cYtN9'><ins id='cYtN9'></ins><ul id='cYtN9'></ul><sub id='cYtN9'></sub></form><legend id='cYtN9'></legend><bdo id='cYtN9'><pre id='cYtN9'><center id='cYtN9'></center></pre></bdo></b><th id='cYtN9'></th></span></q></dt></tr></i><div id='cYtN9'><tfoot id='cYtN9'></tfoot><dl id='cYtN9'><fieldset id='cYtN9'></fieldset></dl></div>