date-range

Date Range Query MySQL

六眼飞鱼酱① 提交于 2019-12-29 07:15:14
问题 I need a query to select data between two dates with today's date as a reference. The database has a datetime field for "start" and a datetime field for "end". $todays_date = date("Y-m-d H:i:s"); $q = "SELECT * FROM news WHERE `end` >= '" . $todays_date . "' AND `start` >= '" . $todays_date . "' ORDER BY id DESC"; The problem is the query is still pulling results where the start date is greater than today. So then i modified my query to look like this: $q = "SELECT * FROM news WHERE `end` >=

Getting Dates between a range of dates

纵饮孤独 提交于 2019-12-27 11:59:13
问题 I need to get all the dates present in the date range using SQL Server 2005 回答1: Here you go: DECLARE @DateFrom smalldatetime, @DateTo smalldatetime; SET @DateFrom='20000101'; SET @DateTo='20081231'; ------------------------------- WITH T(date) AS ( SELECT @DateFrom UNION ALL SELECT DateAdd(day,1,T.date) FROM T WHERE T.date < @DateTo ) SELECT date FROM T OPTION (MAXRECURSION 32767); 回答2: If you have the dates in a table and simply want to select those between two dates you can use select *

Filter out non-contiguous date using momentjs and twix.js

◇◆丶佛笑我妖孽 提交于 2019-12-25 06:09:33
问题 I want to find the last date that is contiguous with all the previous dates in a list. Pictorially: In the above picture I want the circled 'date'. I have a service that exposes a function (copied from memory, as I am not currently at work): var maxContiguousDates = function(listOfDates1, listOfDates2){ ranges = combineDatesIntoTwixRanges(listOfDates1, listOfDates2); //Sort with earliest start first sortedRanges = _.sortBy(ranges,function(range){return -range.start.unix()}) return moment.max

Filter out non-contiguous date using momentjs and twix.js

依然范特西╮ 提交于 2019-12-25 06:09:03
问题 I want to find the last date that is contiguous with all the previous dates in a list. Pictorially: In the above picture I want the circled 'date'. I have a service that exposes a function (copied from memory, as I am not currently at work): var maxContiguousDates = function(listOfDates1, listOfDates2){ ranges = combineDatesIntoTwixRanges(listOfDates1, listOfDates2); //Sort with earliest start first sortedRanges = _.sortBy(ranges,function(range){return -range.start.unix()}) return moment.max

Calculate Sessions Between TimeRange in TSQL

谁说胖子不能爱 提交于 2019-12-25 05:38:23
问题 Here is part of database: SessionID SessionStartTime SessionCloseTime 24 2012-10-16 01:00:06.000 2012-10-16 01:01:22.000 24 2012-10-16 01:00:08.000 2012-10-16 01:01:10.000 24 2012-10-16 01:00:16.000 2012-10-16 01:01:12.000 24 2012-10-16 01:00:30.000 2012-10-16 01:01:48.000 24 2012-10-16 01:00:41.000 2012-10-16 01:02:08.000 24 2012-10-16 01:00:48.000 2012-10-16 01:01:34.000 24 2012-10-16 01:00:56.000 2012-10-16 01:03:09.000 24 2012-10-16 01:01:02.000 2012-10-16 01:02:13.000 24 2012-10-16 01:01

How to calculate Maximum incoming Call Peaks?

瘦欲@ 提交于 2019-12-25 05:25:42
问题 Here is part of database: SessionID SessionStartTime SessionCloseTime 24 2012-10-16 01:00:06.000 2012-10-16 01:01:22.000 24 2012-10-16 01:00:08.000 2012-10-16 01:01:10.000 24 2012-10-16 01:00:16.000 2012-10-16 01:01:12.000 24 2012-10-16 01:00:30.000 2012-10-16 01:01:48.000 24 2012-10-16 01:00:41.000 2012-10-16 01:02:08.000 24 2012-10-16 01:00:48.000 2012-10-16 01:01:34.000 24 2012-10-16 01:00:56.000 2012-10-16 01:03:09.000 24 2012-10-16 01:01:02.000 2012-10-16 01:02:13.000 24 2012-10-16 01:01

Group By Date Range of Sequenced Only

混江龙づ霸主 提交于 2019-12-25 03:45:13
问题 I am trying to generate a date range sequence and put date in second row if sequencing is break. fldDate TotalNo 2015-04-01 10 2015-04-02 10 2015-04-03 10 2015-04-04 10 2015-04-05 10 2015-04-06 10 2015-04-07 10 2015-04-08 10 2015-04-09 12 2015-04-10 12 2015-04-11 12 2015-04-12 12 2015-04-20 12 2015-04-21 12 2015-04-22 12 2015-04-23 12 2015-04-24 12 2015-04-25 12 I am really stumped I want this table as StartDate EndDate TotalNo 2015-04-01 2015-04-08 10 2015-04-09 2015-04-12 12 2015-04-20 2015

Coalescing date ranges in postgres to eliminate overlaps

别说谁变了你拦得住时间么 提交于 2019-12-25 03:44:48
问题 If I have a postgres table a: member | start | end ---------+------------+------------ 1 | 2015-01-01 | 2015-05-01 ---------+------------+------------ 1 | 2015-03-01 | 2015-06-01 ---------+------------+------------ 2 | 2015-01-01 | 2015-05-01 ---------+------------+------------ 2 | 2015-06-01 | 2015-08-01 How would I coalesce dates to eliminate overlapping ranges like this: member | start | end ---------+------------+------------ 1 | 2015-01-01 | 2015-06-01 ---------+------------+------------

Date Range Query using SearchTemplate in Elasticsearch with Should clause

﹥>﹥吖頭↗ 提交于 2019-12-24 11:54:14
问题 We have a scenario where we have to do range query with "OR" condition. It is working fine, with one query, but getting error while triggering with multiple query. POST _scripts/dateTemplate { "script": { "lang": "mustache", "source": """ { "query": { "bool": { "must": { "query_string": { "query": "title:({{searchkeyword}})" } }, "filter": { "bool":{ "must":[ { "match_all": {} } {{#f_url}} , { "terms" : { "f_url": [{{#toJson}}f_url{{/toJson}} ] } } {{/f_url}} ], "should":[ {{#since}} { "range

Input box date range in vba?

放肆的年华 提交于 2019-12-24 05:27:11
问题 I have an excel file and in the first column (A) i have some dates like this: 17/10/2013 18/10/2013 19/10/2013 20/10/2013 21/10/2013 22/10/2013 The other columns contains some datas. I need create an input box that takes everything inside a date range. I mean; i click the button and it shows me a popup like: insert start date: 17/10/2013 (i can decide the date) insert end date: 20/10/2013 (i can decide the date) and then i can put a macro i've done. So my macro read only datas inside that