Take the 2-minute tour ×

Basically what I need is round any date to days. For example: 2014-01-01 14:00:00 should be converted to 2014-01-01.

I was trying to achieve it using DateTimeFormatter but was not able to find a method which would return me an actual joda object but not a String.

share|improve this question
You want to truncate the date. I think this answer will help you: stackoverflow.com/questions/4133682/… –  Magnilex May 13 at 9:05
So your input is a string (e.g. "2014-01-01 14:00:00") and you want the result to be a LocalDate? If not, which Joda object type did you desire? –  Duncan May 13 at 9:09

1 Answer 1

up vote 4 down vote accepted
DateTime d = DateTime.now();
LocalDate ld = new LocalDate(d);

The local date will contain only year, month date

share|improve this answer

Your Answer


