1、获取当前时间的前24小时的各小时时间段

select
to_char(to_date(to_char(sysdate - (rownum - 1) / 24,'yyyy-mm-dd hh24')
|| ':00:00','yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') totaldate
from
dual
connect by
rownum <= 24
order by
totaldate desc

2、获取某天的0点到24点的各小时时间段

select
TO_CHAR(to_date('2019-01-28','yyyy-mm-dd') + (rownum - 1) / 24,'yyyy-mm-dd hh24:mi:ss') TIMES
from
DUAL
connect by
level <= 24

3、获取0点到当前时间的小时段

select
TO_CHAR(to_date('2019-01-28','yyyy-mm-dd') + (rownum - 1) / 24,'yyyy-mm-dd hh24:mi:ss') TIMES
from
DUAL
connect by
level <= to_char(sysdate + 1 / 24,'hh24')

oracle 获取时间的更多相关文章

  1. Oracle获取时间日期月份星期数

    1.日期和字符转换函数用法(to_date,to_char)select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') as nowTime from dual; ...

  2. oracle获取时间毫秒数

    select (sysdate-to_date('1970-01-01','yyyy-mm-dd')-8/24)*24*60*60*1000-1* 60 * 60 * 1000  millisecon ...

  3. Oracle获取系统时间及格式化

    Oracle 获取当前日期及日期格式 获取系统日期:  SYSDATE()   格式化日期:     TO_CHAR(SYSDATE(),'YY/MM/DD HH24:MI:SS)           ...

  4. Oracle 获取当前日期及日期格式

    http://blog.sina.com.cn/s/blog_6168ee920100l2ye.html Oracle 获取当前日期及日期格式 获取系统日期:  SYSDATE()   格式化日期:  ...

  5. Oracle日期时间函数大全

    ORACLE日期时间函数大全 TO_DATE格式(以时间:2007-11-02 13:45:25为例) Year: yy two digits 两位年 显示值:07 yyy three digits ...

  6. ORACLE对时间日期的处理(转)

    共三部分: 第一部分:oracle sql日期比较: http://www.cnblogs.com/sopost/archive/2011/12/03/2275078.html 第二部分:Oracle ...

  7. Oracle修改时间报:ORA-01830: 日期格式图片在转换整个输入字符串之前结束的解决办法

    1.错误原因: date类型不能包含秒以后的精度. 如日期:2010-01-01 20:02:20.0 解决方法:将日期秒以后的精度去除, to_date(substr(INVOICE_DATE,1, ...

  8. [转]ORACLE日期时间函数大全

    本文转自:http://www.cnblogs.com/chuncn/archive/2009/04/29/1381282.html ORACLE日期时间函数大全 TO_DATE格式(以时间: ::2 ...

  9. 【转】ORACLE日期时间 等函数大全

    转自:ORACLE日期时间函数大全 ORACLE日期时间函数大全 TO_DATE格式(以时间:2007-11-02   13:45:25为例)           Year:              ...

随机推荐

  1. cSpring Boot整合RabbitMQ详细教程

    来自:https://blog.csdn.net/qq_38455201/article/details/80308771 十分详细,几张图片不显示,看这个地址 1.首先我们简单了解一下消息中间件的应 ...

  2. Spring Cloud Gateway真的有那么差吗?

    动机 已经不止一次看到"Spring Cloud Gateway性能比Zuul更差"的言论了,不少人人云亦云,来问我,既然如此,那Spring官方还开发Spring Cloud G ...

  3. C# 下sqlite简单使用

    1. 对数据库增, 删, 改 //数据库文件存储路径,(Environment.CurrentDirectory:为当前工作目录的完全路径) string dbPath = "Data So ...

  4. 数据绑定-集合List绑定

    users.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> &l ...

  5. pytorch中的torch.repeat()函数与numpy.tile()

    repeat(*sizes) → Tensor Repeats this tensor along the specified dimensions. Unlike expand(), this fu ...

  6. O019、通过例子学习 Keystone

    参考https://www.cnblogs.com/CloudMan6/p/5373311.html   上节介绍了 Keystone 的核心概念.本节我们通过“查询可用 image”这个操作让大家对 ...

  7. 冒泡排序(java可直接跑,算法思想等小儿科不多说直接上代码)

    import java.util.Arrays; /** *冒泡排序:时间复杂度O(N^2),空间复杂度O(1),稳定的排序 * 每趟确定一个元素的位置,所以需要arr.length趟排序, */pu ...

  8. SpringBoot:spring boot使用Druid和监控配置

    Druid是Java语言中最好的数据库连接池,并且能够提供强大的监控和扩展功能. Spring Boot默认的数据源是:org.apache.tomcat.jdbc.pool.DataSource 业 ...

  9. 87. Scramble String (Java)

    Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrin ...

  10. 微信小程序刮刮乐

    <view class="scratch_body"> <image class="scratch_body_bg" mode="w ...