Questions tagged [date-range]

Date-range refers to a range of dates, i.e. a period of time between a start date and an end date.

Date-range refers to a range of dates, i.e. a period of time between a start date and an end date.

Date range is commonly used:

  • as search criterion for any date related data,
  • when operating on data referring to periods of time.
1608 questions
17
votes
4 answers

Date range validation

I want to compare two dates (StartDate and EndDate) and check whether one is before the other. The simplest solution is to just do it on the backing bean and "short-circuit" the method. However this validation does not happen concurrently with the…
ChrisGeo
  • 3,807
  • 13
  • 54
  • 92
16
votes
2 answers

Check if date is within time range using Joda or standard Java API

I have first time as string '12:00:00' and another '19:00:00'. How to check time portion of the day is within these time values?
EugeneP
  • 11,783
  • 32
  • 96
  • 142
16
votes
3 answers

Include missing months in Group By query

I think I have a tough one here... :( I am trying to get an order count by month, even when zero. Here's the problem query: SELECT datename(month, OrderDate) as Month, COUNT(OrderNumber) AS Orders FROM OrderTable WHERE OrderDate >= '2012-01-01' and…
Michael Nelson
  • 177
  • 1
  • 3
  • 14
15
votes
1 answer

ORACLE SQL Date range intersections

I have a table T1, it contains a NAME value (not unique), and a date range (D1 and D2 which are dates) When NAME are the same, we make a union of the date ranges (e.g. B). But as a result (X), we need to make intersection of all the date…
guigui42
  • 2,441
  • 8
  • 35
  • 48
14
votes
6 answers

C# seconds since specific date

In C# 3.0, how do I get the seconds since 1/1/2010?
craigmoliver
  • 6,499
  • 12
  • 49
  • 90
13
votes
3 answers

Postgres LEFT JOIN with WHERE condition

I need to left join two tables with a where condition: Table time_table id rid start_date end_date 1 2 2017-07-01 00:00:00 2018-11-01 00:00:00 2 5 2017-01-01 00:00:00 2017-06-01 00:00:00 3 …
Syed Asad Abbas Zaidi
  • 1,006
  • 1
  • 17
  • 32
13
votes
1 answer

How to filter last 5 minutes, date histogram using Elastic search?

using Elasticsearch 1.1.1 I'm trying to build a query of "page" views per second for the last 5 minutes for all accounts (so match all). The mapping is... "xxx-20140526": { "mappings": { "xxx": { "properties": { …
user432024
  • 4,392
  • 8
  • 49
  • 85
13
votes
4 answers

How can I group an array of objects by month?

I'm using JavaScript. I have an array that contains data in this format: [ {"USER_NAME":"User1","LAST_SUCCESSFUL_CONNECT":"1373978337642"}, {"USER_NAME":"User2","LAST_SUCCESSFUL_CONNECT":"1374515704026"}, …
Perspectivus
  • 972
  • 1
  • 9
  • 22
12
votes
4 answers

Fastest way to split overlapping date ranges

I have date range data in SQL DB table that has these three (only relevant) columns: ID (int identity) RangeFrom (date only) RangeTo (date only) For any given date range, there may be an arbitrary number of records that may overlap (completely or…
Robert Koritnik
  • 103,639
  • 52
  • 277
  • 404
12
votes
2 answers

MySQL: Matching records that have x consecutive dates available between two dates

Background / Application I have a MySQL database containing a table of rentable properties and a table of bookings for these properties. There is also a search feature for finding available properties between two provided dates. When searching, the…
Kris
  • 1,094
  • 3
  • 13
  • 23
10
votes
3 answers

Mark non-contiguous date ranges

Background (Input) The Global Historical Climatology Network has flagged invalid or erroneous data in its collection of weather measurements. After removing these elements, there are swaths of data that no longer have contiguously dated sections.…
Dave Jarvis
  • 30,436
  • 41
  • 178
  • 315
10
votes
1 answer

Re-index dataframe by new range of dates

I have a data frame containing a number of observations: date colour orders 2014-10-20 red 7 2014-10-21 red 10 2014-10-20 yellow 3 I would like to re-index the data frame and standardise the dates. date …
Gianluca
  • 6,307
  • 19
  • 44
  • 65
9
votes
4 answers

SQL group by frequency within a date range

I have a requirement to write a stored procedure that accepts a start date, end date and a frequency (day, week, month, quarter, year) and outputs a result set based on those parameters. Obviously, the simple part is the query by date range, but how…
Scott
  • 13,735
  • 20
  • 94
  • 152
9
votes
3 answers

jQuery UI Datepicker - Date range - Highlight days in between

I'm looking for a way of highlighting the days in between the date range of 2 inputs on mouse over. This example is nearly doing what I want to achieve: http://hackingon.net/files/jquery_datepicker/range.htm Only difference is that the highlighting…
Mayko
  • 429
  • 1
  • 5
  • 16
9
votes
3 answers

Efficiently find overlap of date-time ranges from 2 dataframes

There are some questions out there regarding finding the overlap in date or time ranges (for example). I've used these to solve my problem, but I've ended up with an extremely slow (and not-at-all elegant) solution to my problem. I would really…
sacuL
  • 49,704
  • 8
  • 81
  • 106