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.

Results 1 to 2 of 2

Thread: Determine hours between two days

  1. #1
    Junior Member
    Join Date
    Feb 2018
    Location
    Colorado Springs
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Determine hours between two days

    Platform: Hp Compaq 6710b
    Operating System: Ubuntu 17.10
    Development Tools: PERL 5.26, postgresql 9.6, netbeans, vim, python 2.7.14, openjdk 9

    This is not for school or anything like it. I am retired and creating my own poker database, and yes I know of the other poker databases out there.

    My problem is I do not know how to compute hours that overlap two or three days. So if I start at 10:00 A.M. on Sept 18 and leave my seat at 3:00 A.M. on Sept 19 what is the algorithm to compute the hours played?

    Doubtful, but if I start at 10:00 A.M. on Sept 18 and leave my seat at 3:00 A.M. on Sept 20 or Sept 21 what is the algorithm to computer the hours played?

    Thank you;

    Sherman

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Determine hours between two days

    Look at the GregorianCalendar and Calendar classes for some methods that may be useful.
    Also the SimpleDateFormat will be useful for converting Strings to Dates.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Days Remaining Total Way Off, Displays Days Since Instead. Please Help??
    By kjc21793 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: October 2nd, 2014, 07:02 PM
  2. How to determine if a String has non-alphanumeric characters?
    By JAVAHELPP in forum What's Wrong With My Code?
    Replies: 0
    Last Post: May 11th, 2013, 07:39 PM
  3. how to determine type of component of listener's source
    By xchan in forum What's Wrong With My Code?
    Replies: 3
    Last Post: April 4th, 2013, 03:43 PM
  4. How to Determine if a String is a Word or Number?
    By megnog in forum Java Theory & Questions
    Replies: 18
    Last Post: April 19th, 2012, 04:31 PM
  5. [SOLVED] Help; algorithm to determine 'range'
    By b_jones10634 in forum Algorithms & Recursion
    Replies: 13
    Last Post: August 24th, 2010, 04:57 PM