Results 1 to 4 of 4
  1. #1
    Join Date
    May 2010
    Posts
    22
    Rep Power
    0

    Default take the total time for particular period

    i am getting the timestamp from database
    Java Code:
    2010-06-01 09:36:13
    2010-06-01 09:37:14
    2010-06-01 09:38:14
    2010-06-01 09:39:14
    2010-06-01 09:39:45
    2010-06-01 17:05:27
    2010-06-01 17:06:28
    2010-06-01 17:07:28
    2010-06-01 17:08:28
    2010-06-01 17:10:29
    2010-06-01 17:11:29
    2010-06-01 17:12:29
    2010-06-01 17:13:29
    i need output
    Code:
    Java Code:
    from                              to
    2010-06-01 09:36:13      2010-06-01 09:39:45-->take the total time(output)
    2010-06-01 17:05:27     2010-06-01 17:08:28-->take the total time(output)
    2010-06-01 17:10:29     2010-06-01 17:13:29-->take the total time(output)
    example
    like this
    2010-06-01 17:05:27-start time
    2010-06-01 17:08:28-end time(total time)
    2010-06-01 17:10:29-start time
    2010-06-01 17:13:29-end time(total time)


    please help me how to write the java code to get the above output

  2. #2
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    5

    Default

    Quote Originally Posted by baktha.thalapathy View Post
    i am getting the timestamp from database
    Java Code:
    2010-06-01 09:36:13
    2010-06-01 09:37:14
    2010-06-01 09:38:14
    2010-06-01 09:39:14
    2010-06-01 09:39:45
    2010-06-01 17:05:27
    2010-06-01 17:06:28
    2010-06-01 17:07:28
    2010-06-01 17:08:28
    2010-06-01 17:10:29
    2010-06-01 17:11:29
    2010-06-01 17:12:29
    2010-06-01 17:13:29
    i need output
    Code:
    Java Code:
    from                              to
    2010-06-01 09:36:13      2010-06-01 09:39:45-->take the total time(output)
    2010-06-01 17:05:27     2010-06-01 17:08:28-->take the total time(output)
    2010-06-01 17:10:29     2010-06-01 17:13:29-->take the total time(output)
    example
    like this
    2010-06-01 17:05:27-start time
    2010-06-01 17:08:28-end time(total time)
    2010-06-01 17:10:29-start time
    2010-06-01 17:13:29-end time(total time)


    please help me how to write the java code to get the above output

    sure, but can you post your code you have so far? to get the output you want is quite easy by we have to now how your resultset looks.

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,311
    Blog Entries
    7
    Rep Power
    20

    Default

    For two timestamps TS1 < TS2 the time difference is TS2-TS1 measured in milli seconds. btw. why did you start a new thread for this?

    kind regards,

    Jos

  4. #4
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,758
    Rep Power
    19

    Default

    Isn't this the third thread you've started on the same topic?

Similar Threads

  1. calculate time diff for particular time period
    By baktha.thalapathy in forum New To Java
    Replies: 2
    Last Post: 05-24-2010, 04:10 PM
  2. how do get particular date of total time
    By baktha.thalapathy in forum New To Java
    Replies: 2
    Last Post: 05-24-2010, 02:09 AM
  3. Addition of period to dates
    By jboy in forum New To Java
    Replies: 4
    Last Post: 09-14-2009, 12:23 PM
  4. Have a period in string, how to make it look nicer
    By JordashTalon in forum New To Java
    Replies: 6
    Last Post: 03-06-2009, 12:23 AM
  5. signing applets for a period of time
    By sandeepk84@gmail.com in forum Java Applets
    Replies: 0
    Last Post: 12-04-2007, 01:34 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
  •