Meaningless Drivel is fun!
The moose likes Java in General and the fly likes how do get particular date of total time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "how do get particular date of total time" Watch "how do get particular date of total time" New topic

how do get particular date of total time

Baktha Elumalai
Ranch Hand

Joined: Mar 13, 2010
Posts: 34
this is our java code

this is output

i am getting the total time for all date

i need only the particular date of total time

2010-05-11-->total time
2010-05-12->Total time
2010-05-13->total time

how do i change the given code to get the above output
please help me anybody having idea

Bakthavachalam E
David Newton

Joined: Sep 29, 2008
Posts: 12617

Loop and add the times while the date is the same?

Some other suggestions:

Use Meaningful Variable Names

Meaningful variable names help people reading your code to discover its intent. Names like "a", "b", "b1", "b2", etc. are almost never a good idea--particularly when a method is this long.

Methods Should Do Only One Thing

And do it well, and do it completely. Similar to how we say classes should have a single responsibility, so to should method. This makes them easier to understand, easier to test, easier to modify, etc. Methods this long should be refactored mercilessly.

Show Only Relevant Code

Particularly when asking for help, it's useful to show only code directly relevant to your question. Code that is commented out, code that has no useful effect (or side effect) should be eliminated for clarity.

Pay Attention to Code Structure and Formatting

Code structure and indention are another way of communicating intent. When there are multiple indent sizes/conventions it's distracting. IDEs have source formatting capabilities--use them.

Isolating What You Care About

Even with only simple formatting enforcement and the removal of useless code things are already easier to cope with, and the bulk of what you're *really* asking about is reduced to this:Note, by the way, that your original code did not handle the case where diffSeconds == 80--that may have been your intent, in which case my code slightly changes the functionality.

I still find the code difficult to follow, however.
pete stein

Joined: Feb 23, 2007
Posts: 1561
Cross-post 1: Sun Forum Thread
Cross-post 2: Java-Forums Thread

Baktha, I hope that your question gets answered, but I think that most here would appreciate it, if when you cross-post a question you provide links to the other cross-posts. Nobody likes duplicating work that's already been done. Thanks for your cooperation. For more details, please look at the forum FAQ's: HowToAskQuestionsOnJavaRanch

and in particular this one: BeForthrightWhenCrossPostingToOtherSites

Much luck!

I agree. Here's the link:
subject: how do get particular date of total time
It's not a secret anymore!