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
7
votes
3 answers

overlapping dates between two date ranges in python

I'm looking to find overlapping dates between two dates ranges as the following: range1 = start(2016-06-01) end (2016-06-20) range2 = start(2016-06-10) end (2016-06-13) result here is 4 dates (2016-06-10,2016-06-11,2016-06-12,2016-06-13). another…
tkyass
  • 2,968
  • 8
  • 38
  • 57
7
votes
3 answers

how to get the shifted index value of a dataframe in Pandas?

Consider the simple example below: date = pd.date_range('1/1/2011', periods=5, freq='H') df = pd.DataFrame({'cat' : ['A', 'A', 'A', 'B', 'B']}, index = date) df Out[278]: cat 2011-01-01 00:00:00 …
ℕʘʘḆḽḘ
  • 18,566
  • 34
  • 128
  • 235
7
votes
1 answer

PostgreSQL daterange not using index correctly

I have a simple table which has a user_birthday field with a type of date (which can be NULL value) CREATE TABLE users ( user_id bigserial NOT NULL, user_email text NOT NULL, user_password text, user_first_name text NOT NULL, …
Shahar Hadas
  • 2,641
  • 1
  • 27
  • 29
7
votes
3 answers

PostgreSQL splitting time range into days

I'm trying to write a complex query using PostgreSQL 9.2.4, and I'm having trouble getting it working. I have a table which contains a time range, as well as several other columns. When I store data in this table, if all of the columns are the same…
CmdrMoozy
  • 3,870
  • 3
  • 19
  • 31
7
votes
2 answers

SQL Date Range Split

Can you please let me know the SQL to split date ranges when they overlap? Data (sample data with a date range and possibly other columns): Col1 FromDate ToDate 1. 1 1/1/2008 31/12/2010 2. 1 1/1/2009 31/12/2012 3. 1 1/1/2009…
user26309
  • 101
  • 1
  • 5
7
votes
2 answers

% of participants that are retained during six months

I am a school teacher very new to MS SQL server. Everyone is suggesting to try this site out. Here goes! I am trying to write queries to test different types of outcome measures for the participation in a academic program. There are several…
Matty34
  • 85
  • 5
7
votes
11 answers

How do you store Date ranges, which are actually timestamps

Java & Oracle both have a timestamp type called Date. Developers tend to manipulate these as if they were calendar dates, which I've seen cause nasty one-off bugs. For a basic date quantity you can simply chop off the time portion upon input, i.e.,…
Chris Noe
  • 36,411
  • 22
  • 71
  • 92
7
votes
3 answers

How to group continuous ranges using MySQL

I have a table that contains categories, dates and rates. Each category can have different rates for different dates, one category can have only one rate at a given date. Id CatId Date Rate ------ ------ ------------ …
Fouzi
  • 73
  • 1
  • 4
6
votes
3 answers

PHP, see if date range is partly within another date range

I've been looking forever for this, but the answer seems nowhere. Here's the problem: Say, I've got two date ranges. $daterange1 = 2012-04-20 till 2012-04-28 $daterange2 = 2012-04-18 till 2012-05-01 Now, I'd like to know if daterange2 is within…
user1128582
  • 81
  • 1
  • 3
6
votes
2 answers

Select a date range from a timestamp column

Currently my table has a column to store date and time. The data type of that column is timestamp without time zone. So it has values in the format '2011-09-13 11:03:44.537'. I need to retrieve rows with respect to the date. If I use: select * from…
user915303
6
votes
4 answers

How to fast filter objects that satisfy date range condition

I have a large collection of objects public class Restriction { // which days this restriction applies to public DateTime From { get; set; } public DateTime To { get; set; } // valid applicable restriction range public int…
Robert Koritnik
  • 103,639
  • 52
  • 277
  • 404
6
votes
2 answers

jQuery alertnative to 'Timeframe' (date range picker)

I'm trying to find a date ranger picker for jQuery. First I found the jQuery Tools solution which looked absolutely perfect, but unfortunately does not work in IE6 which is by far the most commonly used browser here. Then I found a good range picker…
Nick
  • 1,233
  • 13
  • 26
  • 37
6
votes
2 answers

Angular ngx daterangepicker z-index

I'm having multiple forms in an expansion, and I was using this code, for a date picker, Which works totaly fine, the expansion doesn't…
6
votes
2 answers

Combine date ranges in Spark dataframe

I have a problem similar to this one. However, I am dealing with a huge dataset. I was trying to see if I can do the same thing in PySpark instead of pandas. Below is the solution in pandas. Can this be done in PySpark? def merge_dates(grp): #…
Bob
  • 335
  • 1
  • 4
  • 16
6
votes
1 answer

How to extend date_range in Pandas Dataframe?

Some data are collected every 5 seconds and sometimes are missing. After loading them into a Pandas dataframe, I want to define a starting point in time and extract exactly 180 rows (15 minutes x 12 samples per minute), whatever the starting point.…
Alex Poca
  • 2,406
  • 4
  • 25
  • 47