Questions tagged [intervals]

Intervals are used to measure “distance” between values.

Intervals are used to measure “distance” between values.

In the DBMS world interval typically refers to the period between 2 timestamps, many modern RDBMS systems natively supports intervals and operation with them.

More information on the intervals can be found in the wild.

2903 questions
41
votes
2 answers

Quartz.Net how to create a daily schedule that does not gain 1 minute per day

I am trying to build a repeating daily schedule in Quartz.Net but having a few issues: First off, I build a daily schedule, repating at 12:45 Using Quartz.Net code like this: var trigger = TriggerBuilder.Create() .WithDailyTimeIntervalSchedule(s…
Bittercoder
  • 11,753
  • 10
  • 58
  • 76
40
votes
3 answers

how to convert integer minutes to interval in postgres

I'm trying to convert minutes which are in integer to interval in postgres Is there any function that will help me to convert it to interval or should i have divide it by 60 and get the final result 20 minutes will be like 00:20:00 as result
Abhijeet Gulve
  • 799
  • 1
  • 9
  • 23
37
votes
4 answers

ISO 8601 Time Interval Parsing in Java

ISO 8601 defines a syntax for representing a time interval. There are four ways to express a time interval: Start and end, such as "2007-03-01T13:00:00Z/2008-05-11T15:30:00Z" Start and duration, such as…
fellahst
  • 641
  • 1
  • 7
  • 16
32
votes
5 answers

Parse and create ISO 8601 Date and time intervals, like PT15M in PHP

A library and webservice I am using communicates time-intervals in ISO 8601 format: PnYnMnDTnHnMnS. I want to convert such formats to seconds. And vice versa. Seconds are a lot easier to calculate with. Example interval values are: PT1M or PT60S…
berkes
  • 26,996
  • 27
  • 115
  • 206
31
votes
6 answers

Timing in JS - multiple setIntervals running at once and starting at the same time?

Let's say I have a function: myFunc = function(number) { console.log("Booyah! "+number); } And I want it to run on a set interval. Sounds like I should use setInterval, huh! But what if I want to run multiple intervals of the same function, all…
Joshua Soileau
  • 2,933
  • 9
  • 40
  • 51
30
votes
4 answers

Plotting labeled intervals in matplotlib/gnuplot

I have a data sample which looks like this: a 10:15:22 10:15:30 OK b 10:15:23 10:15:28 OK c 10:16:00 10:17:10 FAILED b 10:16:30 10:16:50 OK What I want is to plot the above data in the following way: captions ^ | c | *------* b | *---* …
dm3
  • 2,038
  • 2
  • 17
  • 20
29
votes
3 answers

PostgreSQL how to concat interval value '2 days'

In PostgreSQL I want to concat the current_timestamp with an interval as follows: select current_timestamp + interval 2||' days' But when I do, I get an error: [Err] ERROR: syntax error at or near "2" LINE 1: select current_timestamp + interval…
d-man
  • 57,473
  • 85
  • 212
  • 296
29
votes
5 answers

Algorithm to find the maximum sum in a sequence of overlapping intervals

The problem I am trying to solve has a list of intervals on the number line, each with a pre-defined score. I need to return the maximum possible total score. The catch is that the intervals overlap, and of the overlapping intervals I can use only…
efficiencyIsBliss
  • 3,043
  • 7
  • 38
  • 44
28
votes
4 answers

MySQL select rows from exactly 7 days ago

I'm completely stumped on this one, being trying for hours but with no success, hoping someone can help. Trying to build a cron script to run daily that returns the rows that are exactly 7 days older than the current date. The thing is, my query is…
Tim Blackburn
  • 1,086
  • 2
  • 11
  • 13
26
votes
6 answers

How to convert an interval like "1 day 01:30:00" into "25:30:00"?

I need to add some intervals and use the result in Excel. Since sum(time.endtime-time.starttime) returns the interval as "1 day 01:30:00" and this format breaks my Excel sheet, I thought it'd be nice to have the output like "25:30:00" but found…
Ole
  • 302
  • 1
  • 4
  • 8
25
votes
6 answers

Python: Mapping from intervals to values

I'm refactoring a function that, given a series of endpoints that implicitly define intervals, checks if a number is included in the interval, and then return a corresponding (not related in any computable way). The code that is now handling the…
Agos
  • 18,542
  • 11
  • 56
  • 70
24
votes
6 answers

In JavaScript, how can I have a function run at a specific time?

I have a website that hosts a dashboard: I can edit the JavaScript on the page and I currently have it refreshing every five seconds. I am trying to now get a window.print() to run every day at 8 AM. How could I do this?
user3738622
  • 377
  • 1
  • 2
  • 8
23
votes
2 answers

How to subtract 4 months from today's date?

I need to declare two dates in "Ymd" format: $toDate and $fromDate. $toDate represents today's date and $fromDate needs to be 4 months earlier than today. $toDate = Date('Ymd'); $fromDate = ? How do I create $fromDate?
Jason94
  • 13,320
  • 37
  • 106
  • 184
23
votes
4 answers

JavaScript - Do something every n seconds

I am fairly new to JavaScript, and I am learning it through p5 and videos by Daniel Shiffman. I've been looking for a way to update a program every minute or so that checks a weather api, so I don't have to refresh the page myself. I am aware that…
Zelkins
  • 723
  • 1
  • 5
  • 22
21
votes
4 answers

Python - Rounding by quarter-intervals

I'm running into the following issue: Given various numbers like: 10.38 11.12 5.24 9.76 does an already 'built-in' function exists to round them up to the closest 0.25 step like e.g.: 10.38 --> 10.50 11.12 --> 11.00 5.24 --> 5.25 9.76 --> 9-75…
Daniyal
  • 885
  • 3
  • 16
  • 28