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)

446 questions
2
votes
1 answer

What is the PowerBI/DAX query equivalent of this SQL windowed function

I have the following Table: NDayNo Customer Date CallID 0 A 02/09/2018 48451 24 A 26/09/2018 48452 0 B 21/09/2018 48453 4 B 25/09/2018 48454 0 …
2
votes
4 answers

Remaining days to a date is not showing correctly

Ok, so I've created a function to show the number of days until a date in the future... It is correct until the amount of days is over 9 days.. if over it seems to show a random number of days... Please see my code below: public String…
2
votes
1 answer

How to properly use ThreeTenABP to get the time in milliseconds between two dates based on UTC

I'm using this library I just discovered which is supposedly less heavier than Joda time for android and I said what the heck, let's use it. But now I'm struggling to find any good examples on the web about how to use it, besides these two methods I…
user10217397
2
votes
1 answer

Date difference coming out to be wrong - Python

I had date values in two formats (6/13/2018 and 6-13-2018). I had to calculate date difference. Below is my working. Question: Number of days are coming out to be incorrect for few items. X['Date of Closing'] = X['Date of…
2
votes
2 answers

Moment js return always zero time

I am trying to get duration between now and future time: var d = moment.utc('27.03.2018 - 15:43:01', 'DD.MM.YYYY - HH:mm:ss') var v = moment.utc(moment.duration(d).asMilliseconds()).format("HH:mm:ss") console.log(v); Problem is that v is always…
drothouu
  • 35
  • 1
  • 6
2
votes
1 answer

Difference Between Two Joda DateTime In Months and Left Over Days

I have a requirement to get the amount of months between two DateTime objects and then get the number of days left over. Here is how I get the months between: Months monthsBetween = Months.monthsBetween(dateOfBirth,endDate); I am unsure how to then…
StuStirling
  • 15,601
  • 23
  • 93
  • 150
2
votes
1 answer

Pandas - Date Difference Using Column as Offset

I have a df with two columns: date and offset(integer value). I want to subtract the number of months (based on the column value) from the date and get the month-end date. I've tried: df['NewDate'] = df['Date'] - relativedelta(months=df['Offset'])…
Walt Reed
  • 1,336
  • 2
  • 17
  • 26
2
votes
3 answers

Count the number of days including the two given dates

How to count the number of days between two LocalDate's in java? I tried like this LocalDate startDate = LocalDate.parse("2016-11-02"); LocalDate endDate = LocalDate.parse("2016-11-04"); long days = startDate.until(endDate,…
sreedhar
  • 296
  • 1
  • 5
  • 15
2
votes
4 answers

Hours duration calculation issue using two Date objects

I have a method in my class to calculate the hourly duration of two dates. public static double getDuration(Date startDate, Date endDate){ return (endDate.getTime()-startDate.getTime()) / (1000.0 * 60 * 60); } My input dates are 28-10-2017…
JAVA_CAT
  • 737
  • 3
  • 13
  • 33
2
votes
5 answers

how to calculate number of days between two dates entered by user through datepicker in android studio

I am working on an application where I have two date pickers. How can I calculate the number of days between dates picked by those date pickers? Is there a library or inbuilt function for that? Below is my code: public class ApplyLeave extends…
Akshay
  • 111
  • 1
  • 12
2
votes
2 answers

get last 7 days when user picks up a date

I have a datetimepicker where the user picks up a date, and my requirement is I need 7 days difference between his selected date. For eg, if user has selected 2017-03-01 so i need last 7 days from 2017-03-01 and NOT the current date All answers i…
Ashish Bahl
  • 1,482
  • 1
  • 18
  • 27
2
votes
2 answers

How to calculate the difference in days for two Date in Swift as days start at 6 a.m. instead of 0

I'm trying to get the difference in two Date objects. I know how to do it basically, which is like this: let date = Date() let dateFormatter = DateFormatter() dateFormatter.locale = Locale.current print(count) …
JoshJoshJosh
  • 897
  • 2
  • 11
  • 20
2
votes
1 answer

Is it possible to manipulate dates in Neo4j?

Is it possible to manipulate dates in Neo4j? For eg if today's date is 1/1/2017 can I subtract 5 days from the current date and get 12/28/2016
2
votes
1 answer

Pandas date difference in one column

Here is my dataframe: import pandas as pd df_manual = pd.DataFrame({'A': ['one', 'one', 'two', 'two', 'one'] , 'B': ['Ar', 'Br', 'Cr', 'Ar','Ar'] , 'C': ['12/15/2011', '11/11/2001', '08/7/2015',…
user1700890
  • 7,144
  • 18
  • 87
  • 183
2
votes
0 answers

momentjs week difference float value

Im using momentjs in a nodeapp and then trying to find the difference between 2 dates in weeks like below, var serviceCreated = moment(new Date(service.createdAt)), //fetching this value from DB currentDate = moment(new Date()), delta …
Sai
  • 1,790
  • 5
  • 29
  • 51