• Post Reply Bookmark Topic Watch Topic
  • New Topic

Incrementing time by a specified interval using joda library  RSS feed

 
Karan Saxena
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


The argument value gets it value from jsp at rumtime

The moment the control reaches at :- formatter = DateTimeFormat.forPattern("HH:mm"); it could not go beyond this
I executed this part DateTimeFormat.forPattern("HH:mm"); by pressing cntrl+shift+I and got this message :- could not resolve type: org.joda.time.format.DateTimeFormat

Please help whats wrong

and Please let me know if anything else is wrong with the code


Basically what I want to do is increment time for eg: if time is 09:00 and I want to increment it by 30 then it should become 09:30 and this goes on till the time loop condition is satisfied ,,when i researched on net ,I found out that Joda library is easirer to work with for such tasks ,Please advice and help asap

I am a newbie

 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I executed this part DateTimeFormat.forPattern("HH:mm"); by pressing cntrl+shift+I and got this message :- could not resolve type: org.joda.time.format.DateTimeFormat

Please help whats wrong

You probably haven't added the Joda jar to the runtime classpath.

and Please let me know if anything else is wrong with the code

Your loop won't keep incrementing the value as each time through you are setting time back to 9:00. You need to move the first 2 lines to before the loop.
BTW why don't you use one of the LocalTime constructors to create a LocalTime object with the given time?
 
Knute Snortum
Sheriff
Posts: 4276
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using Maven? If so, try adding something like this to your dependencies:

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!