daterange

How to retrieve all inserted rows during a given month using T-Sql

I'm trying to retrieve all rows inserted during a specific month. SELECT dbo.Post.UserId, dbo.Post.Tags, dbo.Post.CommentCount, dbo.Post.Status, dbo.Post.PostDate, dbo.Post.[Content], dbo.Post.Title, dbo.Post.PostId, dbo.[User].DisplayName FROM dbo.Post INNER JOIN dbo.[User] ON db...

Grouping Date Range by Week

I have a date range where a start date is 2 years prior to today. e.g.) '05/29/2007' ~ '05/29/2009'. How can I break above date range so that I would get a list like the following? (start date starts with "05/27/2007", not "05/29/2007" since the start of weekday is Sunday and '05/27/2007' is the first day of week for '05/29/2007' and t...

C# DataView Date Range with LIKE Operator?!?

I have an XML file: <SMS> <Number>+447761692278</Number> <DateTime>2009-07-27T15:20:32</DateTime> <Message>Yes</Message> <FollowedUpBy>Unassigned</FollowedUpBy> <Outcome></Outcome> <Quantity>0</Quantity> <Points>0</Points> </SMS> <SMS> <Number>+447706583066</Number> <DateTime>2009-07-27T15:19:16</...

Find if a given date is in a list of date ranges

I have a list of events that need processing on a constant basis. The process takes care of the event for some time, whereupon it needs processing again. This means that I end up, for each event, with a list of date ranges in which the event was "taken care of" and any gaps mean the event was in an unprocessed state at that time. For thi...

URL convention for date range

What would be the accepted convention for displaying a date range in a friendly URL? For example, in a time tracking application. Instead of using the database's primary key for a specific pay period in the URL, I would like to use something more easily distinguishable to the user. http://www.mytimesheet.com/11-1-2009-11-14-2009 http:/...

check on overlapping dates (vb.net)

Hi in a program I'm writing I'm creating some objects with a start date (with a datepicker) and an end date (also with a datepicker). Now I need to check if this object's date range overlaps with any other object's date range stored in the database. If it does I can't save it in the database but if it doesn't I can. Anyone has an idea...

Should I make a DateRange object?

Hi. First question ever. A few of my domain objects contain date ranges as a pair of start and end date properties: public class Period { public DateTime EffectiveDate { get; set; } public DateTime ThroughDate { get; set; } } public class Timeline { public DateTime StartDate { get; set; } public DateTime EndDate { get; set;...

Finding complement date ranges?

I have two tables both of which have columns StartDate and EndDate. I'm trying to return a single resultset that contains all date ranges from one table (TableA), and all complement date ranges from the other one (TableB). CREATE TABLE [dbo].[TableA]( [ID] [int] NOT NULL, [StartDate] [datetime] NOT NULL, [EndDate] [datetime...

help in forming mysql query to find free(available) venues/resources for a give date range

I have tables & data like this: venues table contains : id +----+---------+ | id | name | +----+---------+ | 1 | venue 1 | | 2 | venue 2 | --------------- event_dates : id, event_id, event_from_datetime, event_to_datetime, venue_id +----+----------+---------------------+---------------------+----------+ | id | event_id | event_fr...

Perl - Create date range looking at 3 fields

I have 3 Columns of data: Item | CreateDate | Version | ABC | 1/1/2010 | X | ABC | 3/15/2010 | XB | BBB | 2/15/2010 | X | BBB | 6/15/2010 | X | How might I populate two additional columns of data named Version Start & Version End that would calculate the start date of the version and ...

displaying data between date ranges mysql

Hi Guys, I need to work out a period of 6 months (backwards) from a given date. Example date: 07/06/2010 00:00:00 needs to count back 6 months and display: 07/12/2009 00:00:00 I have been scanning through: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html and non of these functions make sense to me :( Hope this m...

Drupal Views how to filter items overlapping a date range

Hi, in Drupal I have used CCK to add a datetime field to my custom data type. It inserts start date and end date fields. That is what I want. Now, I want Views to filter and show only the items that have the daterange (start date and end date) overlapping today's date. Any ideas on how to set it up on Views? What I think is strange is th...

How do I create a period date range from a mysql table grouping every common sequence of value in a column

My goal is to return a start and end date having same value in a column. Here is my table. The (*) have been marked to give you the idea of how I want to get "EndDate" for every similar sequence value of A & B columns ID | DayDate | A | B ----------------------------------------------- 1 | 2010/07/1 | 200 | 300 2 | 2010/07/2 | 2...

How to optimize delete with date range where clause?

I created an android app and there is a function that will periodically delete old records delete from tablea where col1 = 'value1' and col2 = 'value2' and postdate < '2010-06-14' It has performance problem when total number of row in tablea has more then 50,000. It take around 45 seconds to delete 500 records. I already have index f...

SQL Query for Date Range, multiple start/end times

A table exists in Microsoft SQL Server with record ID, Start Date, End Date and Quantity. The idea is that for each record, the quantity/total days in range = daily quantity. Given that a table containing all possible dates exists, how can I generate a result set in SQL Server to look like the following example? EX: RecordID | Start ...

PHP Date Range According to Today's Date

Can anyone think of a better way of writing this out in a loop and getting the same result? $today = date('l'); if($today == 'Wednesday'){ $min = date('l-m-d-y'); $max = date('l-m-d-y', strtotime('+4 days')); }else if($today == 'Thursday'){ $min = date('l-m-d-y', strtotime('-1 days')); $max = dat...

Advanced MySQl query to fetch date specific records within the same table

Hi, I need to findout a better and quick way to query MySQL table to get specific data for each day in a given date range, where the table has two date columns specifying start and end date. Table example: Promotions columns: ID startDate EndDate Discount CategoryID ======================================================...

If I have two time periods, how do I find out if they overlap?

Possible Duplicate: Determine Whether Two Date Ranges Overlap Say I have two objects, and each of these objects have a date ranges which is between its end date and start date, how do I figure out if there is any overlap between the two date ranges in the most efficient or quickest way. I would like to do this using .NET 3.5 ...

Query performance for criteria against date ranges

Here's a table: CREATE TABLE Meetings ( ID int PRIMRY KEY IDENTITY(1,1) StartDate DateTime NOT NULL, EndDate DateTime NULL, Field1 varchar(50), Field2 varchar(50), Field3 varchar(50), Field4 varchar(50) ) There's several thousand rows. The data ranges can be varying sizes (from a couple days up to 50 years). Here's a q...

Validate date between multiple dates in jQuery.validate and datepicker

Hi, I'm using jQuery.datepicker and jQuery.validate. In my form I have multiple date ranges: 2010-02-10 - 2010-02-18 2010-03-01 - 2010-03-12 2010-03-15 - 2010-03-19 etc. Now I need to validate the datepicker field to check if the date set in the datepicker is between any of those date ranges. For instance 2010-01-01 would be invali...