Reputation: 5177
I am the using the Joda library to get the current DateTime in Java. Now I use
DateTime dt = DateTime.now();
to get the current date time object. Now how can I obtain the current time of the day in non military format?
Upvotes: 1
Views: 3829
Reputation: 1544
Right from the Java docs: http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html
What you're looking to do seems to be the first example there:
DateTime dt = new DateTime();
DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
String str = fmt.print(dt);
If it's not the exact format that you're looking for, Java docs will show you the way.
Upvotes: 2