Results 1 to 4 of 4
  1. #1
    Manfizy's Avatar
    Manfizy is offline Senior Member
    Join Date
    Nov 2008
    Location
    Germany
    Posts
    193
    Rep Power
    7

    Post How to use time in java

    Hi people,
    i have a table where i am supposed to record time in and time out and then later am suppused to do calculations on this time.
    How can i make he java program to recognise time during calculation
    For example i want the user to input time in this form(HH:MM) ,14:20, 6:30....

    How can i add and subtract time?

  2. #2
    bubbless is offline Member
    Join Date
    Mar 2009
    Posts
    81
    Rep Power
    0

    Default

    With a regular expression you can seperate the hours from the minutes.
    Then you can multiply the hours with 60 and add the minutes.
    With the total number of minutes you can do calculations.

  3. #3
    Manfizy's Avatar
    Manfizy is offline Senior Member
    Join Date
    Nov 2008
    Location
    Germany
    Posts
    193
    Rep Power
    7

    Default

    Quote Originally Posted by bubbless View Post
    With a regular expression you can seperate the hours from the minutes.
    Then you can multiply the hours with 60 and add the minutes.
    With the total number of minutes you can do calculations.
    Thanks alot for the reply.

    But i still have one more question,after the calculations i want to display the final result in HH:MM formart.How can i achieve this?

  4. #4
    bubbless is offline Member
    Join Date
    Mar 2009
    Posts
    81
    Rep Power
    0

Similar Threads

  1. Replies: 1
    Last Post: 01-12-2009, 09:59 AM
  2. Java 1.5 compile time error
    By ank_k in forum New To Java
    Replies: 4
    Last Post: 11-13-2008, 12:12 PM
  3. Java ME beep(frequency, time)
    By Morfmor in forum New To Java
    Replies: 2
    Last Post: 08-28-2008, 11:34 PM
  4. Time and Date in Java
    By java_fun2007 in forum New To Java
    Replies: 4
    Last Post: 11-06-2007, 08:25 PM
  5. Part time java Programmer-Indianapolis,IN
    By pegitha in forum Jobs Offered
    Replies: 0
    Last Post: 05-08-2007, 05:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •