Questions tagged [period]

A period of time is an interval, a span of time. You can also use it for questions related to the actual punctuation mark.

508 questions
1
vote
1 answer

Pendulum. Period instance. How to get hours from it

No matter what I put after the period a get 0. Why? import pendulum home = 'Europe/Berlin' away = 'America/New_york' a = pendulum.now(home) b = pendulum.now(away) print(a) print(b) dif = b.diff(a) print (dif) di = dif.in_hours() print (di) d =…
ogeretal
  • 509
  • 4
  • 12
1
vote
0 answers

Can I use a datepicker variable in Calculation?

Using a datetime picker and get time in Milli using it get period fro two date pickers. I have two DatePickers based on user input data is stored in Calendar variable to display in a textview. LocalDate today = firstdate; LocalDate secondDate =…
Fathead
  • 11
  • 5
1
vote
1 answer

Find uncovered periods without exploding each combination

I have the following two tables People +--------+---------------+-------------+ | Name | ContractStart | ContractEnd | +--------+---------------+-------------+ | Kate | 20180101 | 20181231 | | Sawyer | 20180101 | 20181231 | | Ben…
Nicolaesse
  • 2,554
  • 12
  • 46
  • 71
1
vote
4 answers

Java: Why java.LocalDate format giving 0 days between 2018-10-25 to 2019-10-25?

import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.Period; import java.time.format.DateTimeFormatter; import java.util.Date; public class DateChal { public static void main(String[] args) { // TODO…
SUVAM ROY
  • 103
  • 1
  • 10
1
vote
1 answer

R split a time interval to multiple periods

Is there a way to split a time interval, say "2018-01-01" to "2019-01-01", to multiple periods/dates? if breaks = "1 month" then it's c("2018-01-01","2018-02-01", ... ) if breaks = "1 quarter" then it's c("2018-01-01","2018-04-01", ... ) if breaks =…
LeGeniusII
  • 900
  • 1
  • 10
  • 28
1
vote
4 answers

How get a data without polling?

This is more of a theorical question. Well, imagine that I have two programas that work simultaneously, the main one only do something when he receives a flag marked with true from a secondary program. So, this main program has a function that will…
Pedro Vieira
  • 2,266
  • 1
  • 20
  • 35
1
vote
2 answers

Why does java.time.Period have no constructor?

Instead, Period.of(int, int, int) must be used, or another static method in the same vein. What's the reasoning behind this?
650aa6a2
  • 172
  • 11
1
vote
2 answers

RewriteRule .? only for one or more chars?

On the net I found several ways of defining a RewriteRule like: RewriteRule .? 404.php [L] RewriteRule . 404.php [L] RewriteRule ^ 404.php [L] But why would these work when entering a garbage url? Because the first (.?) means that there should be…
1
vote
1 answer

PHP Function To Convert Seconds Into Years, Months, Days, Hours, Minutes And Seconds

I don't reall have much knowledge about this but I needed a function that converted secs into y,m,d,h function convertSecToTime($sec) { $date1 = new DateTime("@0"); $date2 = new DateTime("@$sec"); $interval = date_diff($date1, $date2); …
1
vote
1 answer

Date periods based on first occurence

I have a pandas data frame of orders: OrderID OrderDate Value CustomerID 1 2017-11-01 12.56 23 2 2017-11-06 1.56 23 3 2017-11-08 2.67 23 4 2017-11-12 5.67 99 5 2017-11-13 7.88 23 6 …
czyzyk14
  • 55
  • 5
1
vote
0 answers

Branch coverage using Jacoco

I have a problem in hitting the yearsToSubtract == Long.MIN_VALUE branch when the value of yearsToSubtract is Long.MIN_VALUE. public Period minusYears(long yearsToSubtract) { return (yearsToSubtract == Long.MIN_VALUE…
Adithya
  • 241
  • 3
  • 16
1
vote
3 answers

Java Time period in decimal number of years

If I calculate the difference between 2 LocalDate's in java.time using: Period p = Period.between(testDate, today); Then I get an output with the number of years, months, days like: Days = 9 Months = 6 Years = 18 Does anyone know a clean way to…
Luke
  • 1,218
  • 1
  • 24
  • 40
1
vote
1 answer

How to use Pandas.DataFrame query method for index of datetime or period type?

Pandas has a fast query method that works very well but I could not use it to work with period indexes? It works with datetime index but not with Period index!
Ali Khosro
  • 1,580
  • 18
  • 25
1
vote
1 answer

Why do I get wrong dates after the second year when use aggregate?

I'm trying to group my data according to 8-day periods, I found a code that works pretty well for the first year, but then the second one doesn't work well. I'm stuck with this problem. df$date<-as.Date(df$date) z <-aggregate(df$variable, …
MSS
  • 345
  • 4
  • 12
1
vote
1 answer

postgresql: splitting time period at event

I have a table of country-periods. In some cases, certain country attributes (e.g. the capital) changes on a date within a time period. Here I would like to split the country-period into two new periods, one before and one after this change.…
guyus
  • 25
  • 4