java,android,jodatime,period,minute

This is documented behaviour, check out the Javadoc for the plus(Period) function: /** * Returns a new period with the specified period added. * <p> * Each field of the period is added separately. Thus a period of * 2 hours 30 minutes plus 3 hours 40 minutes will produce...

I would suggest subtracting 30 minutes for the hour comparison: select count(*), YEAR(date), MONTH(date), DAY(date) from table where YEAR(date) = 2014 AND HOUR(date - interval 30 minute) between 08 and 17 group by YEAR(date), MONTH(date), DAY(date); Note that the upper limit is 17, assuming that the interval ends just before...

r,datetime,vector,seconds,minute

From help("difftime") If units = "auto", a suitable set of units is chosen, the largest possible (excluding "weeks") in which all the absolute differences are greater than one. units = "auto" is the default. So for a difference of 1 and 61 seconds, if you were to choose minutes, difftime(c((t+1),...

javascript,math,time,seconds,minute

Use Math.round() for subtracting 6.75 from travelTime. This is will round to the nearest whole number.

I don't know why the logic was inverted in the first if(). I think I was confused. Apologies for that. create table temp_table1 as select t.* from (select t1.*, (@rn := if(@prevd = date and minute(time) = @prevm, @rn + 1, if(@prevd := date, if(@prevm := minute(time), 1, 1), 1)...

You can do what you want with delete and aggregation: delete bt from bigtable bt join (select date, min(time) as time from bigtable group by date, hour(time), minute(time) ) btt on btt.date = bt.date and hour(bt.time) = hour(btt.time) and minute(bt.time) = minute(btt.time) and bt.time <> btt.mintime; I am not promising...

postgresql,time,group-by,minute

This may be a bit sub-optimal, but it works. The recursive query detects the start- and stop- times of the intervals; the count(*) scalar subquery counts the number of original records within each interval. WITH RECURSIVE rr AS ( SELECT 1::integer AS num , MIN(tscol) AS starter , MIN(tscol) +...

You could get the date/time and strip of the date part. That time can be compared to other time values. In the code below, I calculate the values in seconds from midnight for the current time, 8:30 and 21:15, and then the if becomes quite simple: $time = time ()...