Questions tagged [date-difference]
Date-difference will give difference in the number of days, months, years etc. between any two calendar dates. (synonyms in stackoverflow.com: datediff, date-diff, date-difference)
416
questions
0
votes
0
answers
19
views
I would like to calculate days between 2 date in days with condition
This is my code :
df["mois0"]=pd.to_datetime("01/10/2021")
df["mois1"]=pd.to_datetime("31/10/2021")
def calculAbsMois(datedebut, datefin, d0, d1):
if ...
0
votes
1
answer
24
views
Calculate difference between highest and lowest value by group in R
I want to calculate the holding period for a dataframe that consists of etherreum transactions. So far I managed to do so using this code:
holdingtime <- fullsample3 %>%
group_by(id) %>%
...
0
votes
1
answer
26
views
how to exclude multiple holidays from DATEDIFF
Basically, I am trying to create a table in Looker (GBQ SQL dialect) that actively tracks if there is a holiday in between two dates, Then calculates the proper date difference.
This code works... but ...
0
votes
2
answers
39
views
Moment JS Date Difference as Month
I'm trying to get the difference between current local time and December 1, 2021 at 4 pm. There is a difference of 6 months and 2 hours. In this case I expect the answer to be something similar to 6....
0
votes
1
answer
47
views
How to Calculate Days,Weeks,Month,Year difference from Today's Date in SQL?
I need to check one process occurred how many times in the selected time period. My time period saved as in Days,Months,Weeks or Year format. Example: 3 Years or 4 Weeks or 2 months or 5 days.. ...
0
votes
1
answer
31
views
Laravel 7: How to calculate difference between two time format value and store in database?
I want to calculate late entry from difference between check_in time and opening_time from Settings table and store the time value in attendance table. Time formate : 10:15:00. The check_in and ...
1
vote
2
answers
47
views
GROUP BY based on dates and number of months
I have a PostgreSQL (many) table with monitoring data. The table contains an ID and Date column. Now I need to classify (group) all this monitoring data in strata (groups) of 6 months. So, in case a ...
1
vote
1
answer
46
views
Is there a more efficient way to calculate the difference in months in R
I have a large data frame in a panel structure (201720 rows; 3 columns) which looks as follows:
Name <- c("A", "A", "A", "B", "B", "B")
...
0
votes
1
answer
43
views
Group by date difference in R
I want to group within a group by date difference.
For example, if there are 7 cases in facility A, but the first 5 cases happened before 14 days of the last 2 cases, I want them to be in two ...
0
votes
0
answers
29
views
Calculating the Difference in Days Between DATE occurrences
Trying to calculate a date difference beteween two occurrences in cases (date1 minus date2 minus 1), but get the following error:
SELECT Failed. 3707: Syntax error, expected something like an 'END' ...
2
votes
3
answers
61
views
How to put output, MsgBox Result on new column
I am tracking payments made on a large excel file. In column C, I have the date we received the payment, in column I, I have the date paid. I'd like to calculate how many months between column C (when ...
0
votes
3
answers
61
views
Calculating the number of dates in specific year, between two dates
I'm trying to figure this out, but it's driving me insane! How do I calculate in SQL the number of days that are in a specific year between two dates? For example: we have the range date [12/30/2016-...
0
votes
0
answers
24
views
calculate time difference between two rows using datetime
I would like to calculate the difference between two row using a time field. I have the query, but the difference is coming out in the second row and not the first. How to i mend so the difference ...
0
votes
0
answers
5
views
Finding the difference of revenue on average between year 2013 and 2014, and group by-ed by product type
I have a table that shows sales of 4 different types of items across different years ( 2012 ~ 2016)
I want to know the increase/decrease of revenue in average between year 2013 and 2014 by each type ...
0
votes
1
answer
22
views
Days tracker in excel, until closure date or today?
I have a spreadsheet with these 3 columns
starting date (has to have a value)
closing date (can have a value or be blank)
days passed (actual days, weekends and such included)
I would like to know ...
0
votes
0
answers
20
views
Is Carbon fixing problem with inaccurate interval in DateTime::diff() in some dates and time zones?
I found that problem with DateTime::diff() was claimed before on StackOverflow and in the manual. Also, I did a short snippet that shows three days difference in results.
I hate that I was using it ...
-2
votes
1
answer
48
views
how to find date difference from two different table in mys
I have two tables
1)LEAD TABLE (which have 3 columns)
Lead_ID || Created_Date || Industry
2)ACCOUNTS TABLE (which have 4 columns)
Account_ID||Created_Date|| Revenue_Range|| Lead_ID
How would I get the ...
2
votes
2
answers
94
views
Join Hours and Minute column for showing in Decimal format SQL Query
I have two datetime columns in a SQL Server table:
+--------------------------+------------------------+
| CompLast_SignON_datetime | comp_accidentdate_time |
+--------------------------+--------------...
3
votes
1
answer
168
views
Android Java : Difference between current time and specific time in future is calculated wrong
I need the difference between current time and specific time in future so that i can pass countdown timer as a parameter. I have function for this operation but it calculates wrong.
Here is my ...
0
votes
0
answers
28
views
DateDiff Calculation - Months [duplicate]
I am trying to calculate a list of employees’ months of service based on the difference of their hire date to the current date. However, if an employee is in the middle of the month, I need the ...
0
votes
0
answers
24
views
Difference between two columns in a data frame which is dynamically varying
I am trying to find the top and least schools by comparing their marks of two terms. So I have stored the data as a data frame. But I am unable to find the difference as they are dynamically varying. ...
0
votes
1
answer
162
views
Time difference between two timestamps in postgres using age is not rounding up
Trying to determine the time difference between two timestamp fields in postgres in HH24:MI:SS format, i.e.
date_started and date_completed
that have the following data:
date_started = 12/11/2021 09:...
1
vote
1
answer
85
views
Calculate days between two dates in Haskell from a custom date ADT
-- a)
leapYear :: Int -> Bool
leapYear n = (n `mod` 4 == 0) && ( (n `mod` 100 /= 0) || (n `mod` 400 == 0) )
-- b)
data Month = Jan | Feb | Mar | Apr | May | Aug | Jun | Jul | Sep | Oct | ...
-1
votes
2
answers
142
views
Calculate Date difference between multiple rows SQL
I need to calculate the date difference between multiple rows. The scenario is I have a vehicle that can do inspections throughout the month as well as when the vehicle is assigned to a different ...
0
votes
0
answers
30
views
Sql add price and date difference to columns
I have a mini project on a hotel and Im trying to add two more columns to my table in sql database that shows how many days someone stayed so a date difference and the price of staying for x amount of ...
2
votes
1
answer
50
views
I am trying to return just the amount of days between deadline and launch date. However it is returning the hours minutes and seconds as well
Here is the code I have so far:
import pandas as pd
df = pd.read_csv('/content/drive/MyDrive/Colab Datasets/KickstarterRevised.csv')
df['deadline'] = pd.to_datetime(df['deadline'])
df['launched'] = ...
2
votes
2
answers
504
views
Date Difference Calculation in Java by excluding weekends [duplicate]
Am very beginner and new to Java platform. I have the below 3 simple Java date difference calculation functions. I wanted to exclude weekends on the below calculations in all the 3 methods. Can anyone ...
0
votes
0
answers
47
views
Successive time difference with POSIXct object in specific unit
I'd like to compute the successive time differences of a vector of date-time (POSIXct object) in a specific unit in R.
With difftime, there is an argument units to force the units. But that's only for ...
-3
votes
1
answer
207
views
How to get only the time difference, ignoring the date difference, between two DateTimeOffset in C#?
i am using c# and I need to get the difference between two DateTimeOffset() ignoring the year, month and day witch mean get the difference between the hour, minutes and the seconds.
lets say this is ...
1
vote
1
answer
54
views
JodaDateTime To BigDecimal Fraction Calculation
I need to calculate the difference between two dates as a fraction which can be used for a subsequent BigDecimal comparison using compareTo(....).
The input dates are java.util.Date so i'm trying to ...
0
votes
0
answers
30
views
how to convert timestamp with Z and count number of days in postregsql?
I need to count num of days btw 2 timestamps like this:
2020-05-29T02:40:33Z
I tried this:
select datediff( rental_ts, return_ts) from table
But getting this error:
function datediff(timestamp with ...
-2
votes
2
answers
478
views
Why ChronoUnit.HOURS.between() is NOT working?
I was trying to get the hours between two local dates. And I used the code below :
LocalDate startDate = LocalDate.of(2000, 4, 30);
long noOfHours = startDate.until(LocalTime.now(), ChronoUnit....
0
votes
2
answers
59
views
Not getting valid no of months from two dates
Need to identify number of months between two dates using java 8 but not getting proper number of months. Please find below program
public static void main(String[] args) {
DateTimeFormatter ...
0
votes
2
answers
170
views
How to use date_diff for two adjacent sessions using BigQuery?
I'm trying to calculate average hours between two adjacent sessions using the data from the following table:
user_id
event_timestamp
session_num
A
2021-04-16 10:00:00.000 UTC
1
A
2021-04-16 11:00:...
1
vote
0
answers
79
views
Difference between two Dates, years, months, days, hours, minutes
I want to create a counter that shows the difference between two dates. Years, months, days and hours work fine, but the minutes are going to -7 when the actual minutes are at 0.
The starting date is ...
2
votes
1
answer
117
views
Number of days in leap years with IsoChronology
2000 CE is a leap year with 366 days.
2001 CE and 2002 CE do not leap years and have 355 days.
Logically, if I ask the number of days between January 1st, 2000 CE and January 1st, 2001 CE, I should ...
0
votes
1
answer
35
views
What's the best way to modify a list of numpy datetime64 objects through finding the time deltas of consecutive objects in the list?
I have a list of numpy datetime64 objects, like so:
time_list_array = [numpy.datetime64('2021-01-01T07:23:00.000000000'),
numpy.datetime64('2021-01-01T07:25:00.000000000'),
...
0
votes
1
answer
53
views
Postgresql average interval between consecutive times--by day of week
I'm trying to get the average and median of the /difference of times/ along my timestamp variable to develop an expectation of whether data is "late" or not, relative to the previous ...
2
votes
2
answers
67
views
Difference current month / month a year back on customer level in Power BI
I am trying to calculate the sales volume difference between a given month and the same month one year back (e.g Jan 2021 - Jan 2020). The tricky part is that it should be done on customer level. My ...
1
vote
1
answer
144
views
Calculate number of payments done between two dates SQL
I want to calculate the number of payments made between two dates in SQL including the start date.
For e.g. if the first payment date is 28/08/2020, and the subsequent payments are done on 28th of ...
0
votes
1
answer
67
views
Group by id and store time difference(intervals) into a list
I have date-time sorted(ascending) data consisting of ID and corresponding time such as:
ID | Time
1 | 2020-02-09 16:39:58
2 | 2020-02-19 17:45:25
1 | 2020-02-09 16:42:25
1 | 2020-02-09 ...
-2
votes
1
answer
66
views
Get difference between two dates with inputs of string
Want to get the difference between the two dates.
Input: Dec 2016 to Feb 2018(string)
Expected Output: 1 year 2 months
is any optimized way to achieve this?
1
vote
1
answer
52
views
Display year difference between start date and end date using Xslt 1
<dates>
<date id="1">2016-09-15</date>
<date id="2">2019-09-15</date>
</dates>
As displayed above I have to input dates one as the ...
-1
votes
1
answer
42
views
difference between two dates is not working in php [closed]
I am using the below code to calculate years, months, and days between 2 dates
$date1=date_create("2015-01-01");
$date2=date_create("2015-12-31");
$diff=date_diff($date1,$date2);
...
-1
votes
1
answer
160
views
DATE_DIFF() in BigQuery to calculate time between rows
I would like to calculate the time delay between several customer purchases. However, each purchase is saved in an individual row. The data set looks similar to the following:
customer | order_id | ...
0
votes
2
answers
265
views
C++ days passed from last check
I wanted to create a program that keeps track of the last time the user watered the plants (manual check). So basically... The user presses a button and the program set today's date as date1, then ...
1
vote
2
answers
115
views
Counting the number of days excluding Sundays between two dates and creating a new column in R DataFrame
I have a data.frame in R in which includes two variables with a Start-Date and an End-Date. I would like to add a new column with the number of days between the two dates and reduce the result by the ...
1
vote
2
answers
50
views
Calculating the average of different investment rounds for different companies in PostgreSQL
I have a table containing the company_id, investments rounds name(like round A, B, C, or IPO ......), and the date(like 2001-05-07) of each investment round for each company.
I want to calculate the ...
3
votes
2
answers
8k
views
Power Query filter date from today minus ? days to today
I'm just learning Power Query and trying to figure out how modify a filter to return data within a dynamic date range. E.g. from Today - 60 days to Today
Here's the code, any help much appreciated.
= ...
0
votes
1
answer
46
views
Excel | Calculate the time difference
I'm trying to calculate the difference in working hours. Depending on the amount, 30 minutes should be deducted for more than 6h (or equal to 6h) (corresponds to the break during working hours). If ...