date函数

跨天查询,少一天的问题

若如初见. 提交于 2019-11-26 12:44:44
业务场景:查询出 #{starttime}到#{endtime}之间的记录 以下基于mybatis mysql数据库 starttime:2018-05-03 endtime:2018-05-04 现实业务中可能需要的数据时间段是2018-05-03 00:00:00到2018-05-04 23:29:59 AND s.create_time BETWEEN DATE(#{starttime,jdbcType=DATE}) and DATE(#{endtime,jdbcType=DATE}) 这个语句只能查出2018-05-03 00:00:00到2018-05-04 00:00:00的数据,丢了24小时 改良方法,使用Date_add函数加一天 DATE_ADD(time,interval 1 day) AND s.create_time BETWEEN DATE(#{starttime,jdbcType=DATE}) and DATE_ADD(DATE(#{endtime,jdbcType=DATE}),INTERVAL 1 DAY) 来源: https://www.cnblogs.com/passedbylove/p/11320574.html

react 组件的构造函数

╄→尐↘猪︶ㄣ 提交于 2019-11-26 12:31:46
constructor 函数时组件最先执行的函数 class childen extends react.Component{ constructor(props){ super(props); this.state={ attr1:"", } } } 一般在constructor函数中都会存在 上述方法,个人对其的理解 constructor():子类继承父类时的构造方法,主要时用以定义this.属性 在react中一些默认的数据可以直接在此处定义 import React from 'react'; class Mine extends React.Component { constructor(a) { super(a); this.state = { date: new Date().getTime() } //定义custom 和state并没有什么本质的区别,在都可以通过this都访问,但是推荐使用state 因为在react中 即使我们不定义this.state //this下仍会有一个默认的state属性,具体作用暂时没有发现,感兴趣的同学可以深入了解一下 this.custom = { date: new Date().getTime() } console.log(a); } componentWillMount() { console.log("在渲染前调用"

Mysql之DATE_FORMAT()

☆樱花仙子☆ 提交于 2019-11-26 10:51:38
DATE_FORMAT() 函数用于以不同的格式显示日期/时间数据。 语法: DATE_FORMAT(date,format)date 参数是合法的日期。format 规定日期/时间的输出格式。例1:SELECT DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%S');结果:2019-08-07 22:32:43例2:SELECT DATE_FORMAT('20190807','%Y-%m-%d %H:%i:%S');结果:2019-08-07 00:00:00 来源: https://www.cnblogs.com/yaoze2018/p/11318314.html

时间类型转换

 ̄綄美尐妖づ 提交于 2019-11-26 02:31:41
一、Date类型 将Date转为字符串 String format = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss" ) . format ( new Date ( ) ) ; 将字符串转为Date DateFormat df = new SimpleDateFormat ( "yyyy-MM-dd hh:mm" ) ; Date date = df . parse ( "2018-08-08 20:08:08" ) ; 将Date转为时间戳 DateFormat df = new SimpleDateFormat ( "yyyy-MM-dd hh:mm" ) ; Date date = df . parse ( "2018-08-08 20:08:08" ) ; long time = date . getTime ( ) ; 如果遇到比较时间大小的,都使用时间戳的形式比较大小。 二、LocalDateTime类型 将LocalDateTime转为时间戳 Long milliSecond = endTime . toInstant ( ZoneOffset . of ( "+8" ) ) . toEpochMilli ( ) ; 将时间戳转为LocalDateTime类型 LocalDateTime dateTime = new

SQL函数计算流量的95值

十年热恋 提交于 2019-11-26 01:06:28
我用的是Solarwinds系统,部分内容就结合Solarwinds系统一起写了。最后落地也是通过系统的Report定时自动出报告并且可以发邮件。 不过计算方法是通过定义SQL函数,然后使用SQL查询来获取到的,这部分内容是通用的。 95th 计算方法 从 Solarwinds 官方网站搜索“95th”关键字能获取到说明的文档。 95th Percentile Calculations in the Orion Platform: https://documentation.solarwinds.com/en/Success_Center/orionplatform/Content/Core-95th-Percentile-Calculations-sw80.htm Over the 10 hours, the following 120 values were collected for inbound traffic (Mb/s): 0.149 0.623 0.281 0.136 0.024 0.042 0.097 0.185 0.198 0.243 0.274 0.390 0.971 0.633 0.238 0.142 0.119 0.176 0.131 0.127 0.169 0.223 0.291 0.236 0.124 0.072 0.197 0.105 0.138 0

Python中xlrd和xlwt模块使用方法----》》数据库数据导出(之一)

烂漫一生 提交于 2019-11-26 01:05:47
xlrd模块实现对excel文件内容读取,xlwt模块实现对excel文件的写入。 (1) 打开excel文件并获取所有sheet >>> import xlrd >>> workbook = xlrd.open_workbook(r'D:\Program Files\Notepad++\Student.xlsx') >>> print workbook.sheet_names() [u'Sheet1', u'Sheet2', u'Sheet3'] (2) 根据下标获取sheet名称 >>> sheet2_name=workbook.sheet_names()[1] >>> print sheet2_name Sheet2 (3) 根据sheet索引或者名称获取sheet内容,同时获取sheet名称、行数、列数。 >>> sheet2 = workbook.sheet_by_index(1) >>> print sheet2.name,sheet2.nrows,sheet2.ncols Sheet2 6 5 >>> sheet2 = workbook.sheet_by_name('Sheet2') >>> print sheet2.name,sheet2.nrows,sheet2.ncols Sheet2 6 5 (4) 根据sheet名称获取整行和整列的值 >>> sheet2

React学习笔记(二) 组件

假如想象 提交于 2019-11-25 22:19:40
组件允许我们将代码拆分为独立可复用的代码片段,这是一个十分重要的概念 1、函数组件 我们可以通过编写 JavaScript 函数定义组件 <!DOCTYPE html> <html> <head> <title>Demo</title> <script src="https://unpkg.com/react@16/umd/react.development.js"></script> <script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script> <script src="https://unpkg.com/babel-standalone"></script> </head> <body> <div id="app"></div> <script type="text/babel"> // 通过 function 定义组件,函数返回一个 React 元素 // 需要注意的是,组件名称必须以大写字母开头 // 因为 React 会将以小写字母开头的组件视为原生 DOM 标签 function SayHello() { return <h1>Hello World</h1>; }; // React 元素不仅仅是 DOM 标签,也可以是自定义组件 const element =

oracle定时执行存储过程

一曲冷凌霜 提交于 2019-11-25 22:15:01
需求 每小时进行一次查询统计数据,并将数据插入到自定义的表当中 效果 创建存储过程 create or replace procedure summary_data as v_dcppv number; v_jd12h number; v_dby number; v_xby number; v_bj number; v_bn number; v_zdzf number; v_wxzf number; v_jfzf number; v_yhdj number; v_dgzs number; v_tds number; v_tds2 number; begin --单次 select count(1) into v_dcppv from iptvsp_wt_req a where servicecode = 'JK0008' and a.instime between trunc(sysdate, 'hh') - 1 / 24 and trunc(sysdate, 'hh') - 1 / 86400 and orderstatus = 1 and order_type in (0, 1) and order_time IN (48, 30) and a.user_id like '116%'; --酒店 select count(1) into v_jd12h from iptvsp