Linked Questions

-3 votes
2 answers
11k views

Possible Duplicate: In Java, how do I get the difference in seconds between 2 dates? Hi i have two dates as follows 1970-01-01 and 2011-08-01 which are in yyyy-mm-dd format. How to find out the ...
Navanithakrishna Enighanti's user avatar
1 vote
1 answer
2k views

I am practically checking how much time taking by collection(s) insertion with 'N' elements, Now I am stuck in checking total time taken by ArrayList in Insertion process. Timestamp startTimeStamp =...
Uday Kiran's user avatar
-1 votes
1 answer
91 views

I'm trting to send data every 10 seconds , so I'm trying tp use this code I wrote but I think I made a mistake in the converting to seconds? Calendar Time= Calendar.getInstance(); Calendar SendDate=...
Korenron's user avatar
  • 101
-2 votes
1 answer
103 views

I'm stuck between java.time.temporal.ChronoUnit and java.time.temporal.Temporal until. How do they work??
dummy dummy's user avatar
0 votes
0 answers
63 views

How would I calculate the time difference in minutes from the current time against a date/time in the format of "August 3, 2021 at 4:29 PM"?
selbay84's user avatar
411 votes
12 answers
530k views

I am trying to calculate the difference between two LocalDateTime. The output needs to be of the format y years m months d days h hours m minutes s seconds. Here is what I have written: import java....
Tapas Bose's user avatar
235 votes
3 answers
44k views

I'm using Android Studio 2.1.2 and my Java setup is the following: >java -version > openjdk version "1.8.0_91" > OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-3ubuntu1~15.10....
kael's user avatar
  • 6,765
10 votes
4 answers
14k views

I want to calculate time difference in seconds between to time instants. For example, during execution of the program, I set the value of a variable and after some time I change it again. What was the ...
Space Rocker's user avatar
4 votes
5 answers
3k views

I would like to measure elapsed time in a Java. However differences in System.currentTimeMillis() and (I believe) System.nanoTime() can be changed by external changes eg someone (or the system) ...
Pool's user avatar
  • 12.4k
-5 votes
3 answers
10k views

I am using following function to calculate time difference. It is not showing proper output. After 1 month time difference it is showing 2 minutes difference. What is wrong with my program? public ...
manish m's user avatar
2 votes
2 answers
3k views

There are a plethora of SO questions that deal with calculating the difference between two dates or two times in Java. Many answers point out the problems with the core Java Date classes, and suggest ...
amaidment's user avatar
  • 7,386
1 vote
2 answers
4k views

I want to find difference between 2 timestamps. What I am doing is storing 1st timestamp in shared prefs and try to subtractt it from the new timestamp. To get timestamp, I am using - public static ...
Monique890's user avatar
1 vote
2 answers
2k views

I am currently in the early stages of writing a multi-faceted investment algorithm. The part I am currently working on is concerned with using a Graphical Gaussian Model with a LASSO penalty to find ...
lel23's user avatar
  • 57
-4 votes
2 answers
4k views

I have a date column in postgres db whose value is 2018-11-20 22:07:20. The datatype is timestamz. I want to get the above value in java code and convert that to seconds with respect to the current ...
Abhishek's user avatar
  • 690
0 votes
3 answers
745 views

I'm having trouble understanding getting timestamps, subtracting them, and being able to assign and use the difference in future calculations. I am using Java in Android Studio. When I use ...
Tep's user avatar
  • 13