hi thanks for your help
How to calculate if today is 22:40:30 and tomorrow is 05:10:45, what hour and minute and second between these two times? That is, exactly what time it is?
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
hi thanks for your help
How to calculate if today is 22:40:30 and tomorrow is 05:10:45, what hour and minute and second between these two times? That is, exactly what time it is?
Last edited by cnmeysam; March 29th, 2021 at 03:08 PM.
Its all arithmetic. There are 24 hours in a day, 60 minutes in an hour and 60 seconds in a minute.
Work in seconds. Get difference, divide by 2, add to first date and convert to H:M:S for results.
If you don't understand my answer, don't ignore it, ask a question.
cnmeysam (March 29th, 2021)
It means
after that i don't now how i must find timeprayerTimes.get(0) = 05:10:45 prayerTimes.get(4) = 22:40:30 String t3 = prayerTimes.get(0); String t4 = prayerTimes.get(4); System.out.println(t3 + "--" + t4); System.out.println(Duration.between( LocalTime.parse(t4), LocalTime.parse(t3) ).plusNanos(1).withNanos(0));
Last edited by cnmeysam; March 25th, 2021 at 06:06 PM.
Work on the logical steps required to solve the problem BEFORE writing any code.
Can you make a list of the steps required?
There may be some ideas here: https://www.baeldung.com/java-date-difference
If you don't understand my answer, don't ignore it, ask a question.
cnmeysam (March 29th, 2021)