date-range

Create new column based on condition that exists within a rolling date

怎甘沉沦 提交于 2019-11-29 15:31:07
问题 To make this question more generalized, I believe it could also be rephrased as: Creating a rolling temporally sensitive factor variable . Though an uncommon requirement, this could be utilized for many different data sources. I have a series of non-uniform time data with > 1 record per day for thousands of users. I want to create a new column player_type that keeps track of a rolling 30 day definition of their behavior. The behavior is defined by what games they play; the column 'games' is a

Date range validation

无人久伴 提交于 2019-11-29 12:32:00
问题 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 other form validations. For example if I have another field that requires validation (besides the dates) and has invalid input, I will only get a message for that specific field. Only if the other fields are valid will I get the date validation

MVC Model Range Validator?

痴心易碎 提交于 2019-11-29 11:28:46
i wnat to validate the datetime, My Code is: [Range(typeof(DateTime), DateTime.Now.AddYears(-65).ToShortDateString(), DateTime.Now.AddYears(-18).ToShortDateString(), ErrorMessage = "Value for {0} must be between {1} and {2}")] public DateTime Birthday { get; set; } but i get the error: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type please help me? mfanto This means the values for the Range attribute can't be determined at some later time, it has to be determined at compile time. DateTime.Now isn't a constant,

if value is between two numbers

允我心安 提交于 2019-11-29 09:27:04
I want to be able to test whether a value is within a number range. This is my jQuery code... if ((year < 2099) && (year > 1990)){ return 'good stuff'; } Is there a simpler way to do this in jQuery? For example, is there something like this... if (1990 < year < 2099){ return 'good stuff'; } In many languages, the second way will be evaluated from left to right incorrectly with regard to what you want. In C, for instance, 1990 < year will evaluate to 0 or 1, which then becomes 1 < 2099 , which is always true, of course. Javascript is a quite similar to C: 1990 < year returns true or false , and

Merge overlapping time intervals, how?

六月ゝ 毕业季﹏ 提交于 2019-11-29 09:01:11
Anyone could help me in a query that **merge a interval of datas? ex: Common select: SELECT id, date_start, date_end FROM evento ORDER BY date_start I GOT THIS: FROM THIS: but a want a query that return this: 01 - 2013-10-11 08:00:00 2013-10-11 15:00:00 02 - 2013-10-11 16:00:00 2013-10-11 19:00:00 Thanks a lot! You may also try this query (once more solutions beside those given by PM 77-1 in the comment above) : WITH RECURSIVE cte( id, date_start, date_end ) AS ( SELECT id, date_start, date_end FROM evento UNION SELECT e.id, least( c.date_start, e.date_start ), greatest( c.date_end, e.date_end

Date Range Query MySQL

有些话、适合烂在心里 提交于 2019-11-29 08:42:57
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` >= '" . $todays_date . "' AND `start` >= '" . $todays_date . "' AND `start` <='" . $todays_date . "' ORDER

Crystal Reports Need to Group by Derived Date Range

只愿长相守 提交于 2019-11-29 07:36:21
Long time listner, first time caller. I'm using Crystal Reports 2010. I have daily trade information that I need to group together if the volume doesn't change. Here's what the data looks like. Trade# BegDate EndDate Volume 1 1/1/2012 1/2/2012 500 1 1/2/2012 1/3/2012 500 1 1/3/2012 1/4/2012 1000 1 1/4/2012 1/5/2012 750 1 1/5/2012 1/6/2012 750 1 1/6/2012 1/7/2012 500 1 1/7/2012 1/8/2012 500 1 1/8/2012 1/9/2012 500 I need it to look like this. Trade# DateRange Volume 1 1/1/2012 - 1/3/2012 500 1 1/3/2012 - 1/4/2012 1000 1 1/4/2012 - 1/6/2012 750 1 1/6/2012 - 1/9/2012 500 I need to group by the

jQuery UI Datepicker - Date range - Highlight days in between

廉价感情. 提交于 2019-11-29 02:20:44
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 of the selected range should happen on two separate datepickers and on mouse over. Any suggestions? Update: Ok, a bit more details: After selecting a date from the first datepicker, the second datepicker should highlight the previous selected date. If you then mouse over a day past the previous selected day, all days in between should highlight by

Fetching rows added last hour

╄→尐↘猪︶ㄣ 提交于 2019-11-29 02:06:19
问题 I keep a record of logins in a table. I have columns for id, ip, date and time. From that record of logins I wanna fetch logins made only in the last hour. I'm sweeping through the MySQL docs on time and date functions, but I just can't seem to combine them correctly. Can somebody help me? 回答1: Make use of the DATE_SUB() and Now() functions: select count(*) as cnt from log where date >= DATE_SUB(NOW(),INTERVAL 1 HOUR); Hope it helps you : ) 回答2: If you want to implement this into a cronjob,

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

吃可爱长大的小学妹 提交于 2019-11-28 21:24:02
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? Using Joda Time you could do something like this: DateTime start = new DateTime(2010, 5, 25, 12, 0, 0, 0); DateTime end = new DateTime(2010, 5, 25, 21, 0, 0, 0); Interval interval = new Interval(start, end); DateTime test = new DateTime(2010, 5, 25, 16, 0, 0, 0); System.out.println(interval.contains(test)); Create calendar instances of the start and end times for the same day as your 'test' date. Then you can easily compare the calendar objects to determine if the