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
6
votes
4 answers

Python Pandas dataframe subtract cumulative column

I have some data that I am importing into a Pandas dataframe. This data is "cumulative" and indexed on a time series, see below: Raw data 2016-11-23 10:00:00 48.6 2016-11-23 11:00:00 158.7 2016-11-23 12:00:00 …
pottolom
  • 279
  • 5
  • 17
6
votes
1 answer

Pandas Create Range of Dates Without Weekends

Given the following data frame: import pandas as pd df=pd.DataFrame({'A':['a','b','c'], 'first_date':['2015-08-31 00:00:00','2015-08-24 00:00:00','2015-08-25 00:00:00']}) df.first_date=pd.to_datetime(df.first_date)…
Dance Party
  • 3,459
  • 10
  • 42
  • 67
6
votes
6 answers

SQL DateDiff without weekends and public holidays

I am looking for solution how to select number of days between two dates without weekends and public holidays. So far I have this: SELECT evnt.event_id, evnt.date_from, evnt.date_to, DATEDIFF(DD, evnt.date_from, evnt.date_to) …
Kajiyama
  • 3,393
  • 8
  • 26
  • 38
6
votes
1 answer

Using yii2 date range in active record

i have a date field in my database which has datetype as data type, how can i use active record to fetch data according to specific date range? $model = ModelName::find() ->where(["date"=>"FROM '2015-06-21' TO '2015-06-27' ",…
Pingu Kutu
  • 357
  • 2
  • 5
  • 11
6
votes
1 answer

R Shiny Date range input

I have a date range input function as follows in my ui for my shiny app. dateRangeInput("dates", "Date range", start = "2015-01-01", end = as.character(Sys.Date())) However I want a pop up message to correct the user if the user…
Vik
  • 469
  • 2
  • 6
  • 18
6
votes
3 answers

Group by date intervals

I have a collection with documents like this: { datetime: new Date(), count: 1234 } I want to get sums of count by 24 hours, 7 days and 30 days intervals. The result should be like: { "sum": 100, "interval": "day" } { "sum": 700, "interval":…
jonasasx
  • 123
  • 1
  • 1
  • 9
6
votes
3 answers

How to get all weekends within a date range in C#

Is there a simple way or framework to get all weekends within a date range in C#? Is it possible to do with LINQ as well?
NoWar
  • 36,338
  • 80
  • 323
  • 498
6
votes
3 answers

Find all intersections of all sets of ranges in PostgreSQL

I'm looking for an efficient way to find all the intersections between sets of timestamp ranges. It needs to work with PostgreSQL 9.2. Let's say the ranges represent the times when a person is available to meet. Each person may have one or more…
EM0
  • 5,369
  • 7
  • 51
  • 85
6
votes
1 answer

Insert "daterange" field value into PostgreSQL table through JDBC

I have a table in PostgreSQL(9.3) with daterange field type. I can select this field like a String with JDBC, but I cannot Insert it in a table. What I've tried: PreparedStatement stm = conn.prepareStatement("insert into mytable (my_daterange_field)…
6
votes
4 answers

Select rows with no date range overlap

Imagine the following Loans table: BorrowerID StartDate DueDate ============================================= 1 2012-09-02 2012-10-01 2 2012-10-05 2012-10-21 3 2012-11-07 …
George Brighton
  • 5,131
  • 9
  • 27
  • 36
6
votes
4 answers

WP_Query meta_query date range with 2 custom fields

I have a custom post type 'events' that contains custom fields for start_date and end_date. I'm trying to make a simple list of upcoming events. If I query only events with a start_date >= today it works fine. If I add in a meta_query to say "AND"…
forwardtrends
  • 121
  • 1
  • 2
  • 8
6
votes
1 answer

Doing range queries in Mongoose for Hour / Day / Month/ Year

Trying to figure out how to do this. Basically I want to sort by Hour / Day / Month / Year of my submissions. Each submission has a created field which contains a Mongoose Date object in the form of "created" : ISODate("2013-03-11T01:49:09.421Z").…
bob_cobb
  • 2,229
  • 11
  • 49
  • 109
5
votes
3 answers

datatables date filter

I have one Date column, formatted '17/03/2012'. I would like to be able select a start and end date and if the 1 date column above is within this date range it will filter the column. Below is the code im using: Start Date:
Codded
  • 1,256
  • 14
  • 42
  • 74
5
votes
2 answers

Select multiple dates with DatePicker

I am trying to create a DatePicker that selects multiple dates. I am able to select multiple dates but I would like to keep the DatePicker open while I select them. Problem is, the DatePicker will close every time I select a date. I don't want to…
trilogy
  • 1,738
  • 15
  • 31
5
votes
1 answer

how can i use the Postgres DateRange type with TypeOrm

i try to implement basic Hotel booking system with Nest.js framework. i use TypeOrm and Postgres Database. i have a booking Entity (room reservation in the hotel) and Booking should have a DateRange (from check-in to checkout date). i cannot find…
ggcarmi
  • 458
  • 4
  • 17