Questions tagged [dateinterval]

Data type used for capturing a interval between two date objects. This is found in PHP, Swift, and likely other languages too.

Data type used for capturing a interval between two date objects. This is found in many languages including PHP and Swift (and likely other languages, too).

For more information, see:

221 questions
1
vote
0 answers

What is the equivalent of Google's Dialogflow's `@sys.date-period` if you're using Actions Console?

I'm struggling to come to grips with the differences in Google's natural language processing tools. It seems Dialogflow was the original purchase but now Google appears to be egging people on to the "Actions Console". I'm not even sure if this is a…
Eugene van der Merwe
  • 4,390
  • 1
  • 35
  • 48
1
vote
0 answers

PHP DateInterval Wrong Result

When trying to create DateInterval with 2376000 seconds (exactly 660 hours), newly created object returns interval equal to 659 hours. It works fine for smaller numbers, but above certain value it just loses somewhere 1 hour. $interval = new…
Filip Kaszczyński
  • 139
  • 1
  • 2
  • 15
1
vote
3 answers

How to compare INTERVAL YEAR TO MONTH data types in Oracle SQL Developer?

so I have table Product_Information Product Data type Product_ID NUMBER(6,0) Warranty_Period INTERVAL YEAR(2) TO MONTH How should I do a diapason check between intervals? This is the code I've tried case W.WARRANTY_PERIOD when…
kikiriki
  • 13
  • 3
1
vote
0 answers

PHP \DateInterval calculation number of months incorrect

Since the PHP timezone was changed in a project, \DateTime::diff does not longer calculate the number of months between two dates correctly. Here is some example code to reproduce the problem:

        
1
vote
0 answers

3 days != 72 hours with DateInterval in PHP

A plain simple task of subtracting time (hours) from a DateTime object leaves me wondering. I have a DateTime, in my case 2021-03-28 08:45. I want get back 3 days from that point in time. For that I clone my start date and substract 3…
cb0
  • 8,415
  • 9
  • 52
  • 80
1
vote
2 answers

Get all weeks of specified month, weeks from Sun-Sat

EDIT I tried this code directly below. It's close, but still not finding the weeks from 1st of month to 1st saturday, then every week after from Sun-Sat, until last Sun to end of month. function get_weeks($month, $year) { $weeks = array(); …
JonnyPlow
  • 187
  • 1
  • 8
1
vote
1 answer

PostgreSQL / TimescaleDB query that group data by custom interval

I have a working query that allows me to sum value field each day. SELECT sum(value) as sum_value, to_char(time::date,'DD-MM-YY') as day FROM "measures" GROUP BY "day" ORDER BY "day" asc Is it possible to do the same query, but instead of…
Juliatzin
  • 18,455
  • 40
  • 166
  • 325
1
vote
2 answers

Find dates between 2 dates with custom interval and without overflow

I have a customisable DateInterval object, along with a customisable start and end date. I want to find the dates between the start and end using the interval. I am using Carbon to try and help with this. Here's the problem: I the interval is …
Wildcard27
  • 1,437
  • 18
  • 48
1
vote
2 answers

month starting date and ending date between a range of date in python

the input is a range of date for which we need to find the starting date of the month and end date of the month of all date in between the interval. example is given below input: start date: 2018-6-15 end date: 2019-3-20 desired output: [ …
1
vote
2 answers

PHP DateTime difference in hours with timezone gives 0 instead of 2

I'm trying to build a list of timezone with the time difference between the php timezone code and UTC. I've try a few lines of code with diff: $utc_date = new DateTime( NULL, new DateTimeZone('UTC') ); echo 'UTC: ' .…
pkiener
  • 15
  • 4
1
vote
0 answers

Doctrine DateInterval in QueryBuilder

Doctrine 2 supports FieldType "interval" and it is stored in DB as varchar "+P00Y00M168DT00H00M00S" For Entity's this is enough to add this to an DateTime-Object. But i wonder why this can't used in QueryBuilder. Should i create a Custom…
Marcus Wolf
  • 235
  • 1
  • 3
  • 12
1
vote
2 answers

How to create a dummy variable for date interval

I have been trying to generate a dummy variable from the data column for interval. Sample data Date <- seq(as.Date("1988-01-01"), as.Date("2018-12-31"), by="1 day") DATASET <- data.frame(rnorm(11323), Date) I would like to create an interval:…
Ewa
  • 43
  • 7
1
vote
2 answers

Symfony4: Validate DateIntervalType

I am currently stuck on a probably very simple question. How do I validate my DateIntervalType to be != 0 - meaning atleast something has been selected. And how do I set a minimum/maximum: for example minimum interval of 1 day. Background: I want…
Syllz
  • 290
  • 6
  • 22
1
vote
0 answers

How to recover the years, months and days of a Dateinterval with JavaScript?

I am using Symfony 4 and a Database in which my information is stored. I retrieve them with a Fetch in JavaScript. In my Entity, I have an object of type "dateinterval". In the Database, for an item I have + P00Y00M14DT00H00M00S. When I get that in…
1
vote
1 answer

exclude Array of DateInterval from Array of DateInterval

I want to exclude Array of DateInterval from Array of DateInterval. This's my code, but I don't think it will not be helpful.. it goes in infinite loop sometimes and I couldn't solve it. extension DateInterval { static func exclude(_…
Dot Freelancer
  • 4,083
  • 3
  • 28
  • 50