• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I convert String to DateTime?  RSS feed

 
wladimir bandeira
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I'm with the following algorithm.





This code is giving the following result;

Quantidade de dias: 49

Who does the calculation is the method daysBetween

being the daysBetween method takes only DateTime.

I wish I could get a string and convert to DateTime.

How do I do this?
 
Knute Snortum
Sheriff
Posts: 4288
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joda Time has two parse methods. Will either of these work?

Also, Java 8 has similar behaviors.
 
Stephan van Hulst
Saloon Keeper
Posts: 7993
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you can help it, don't use DateTimes at all.

If you use Joda-Time or Java 8, use their respective LocalDateTime classes instead.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!