Java Ninja Chronicles By Norris Shelton

Things I learned in the pursuit of code

To parse a string into a DateTime object:

DateTimeFormatter fmt = DateTimeFormat.forPattern("MM/dd/yyyy");
DateTime dt = fmt.parseDateTime(strInputDateTime);

To output the formatted value of a DateTime object as a String:

fmt.print(myDateTime)

January 11th, 2011

Posted In: Collections, Java, Joda-Time

Leave a Reply

Your email address will not be published. Required fields are marked *

WP to LinkedIn Auto Publish Powered By : XYZScripts.com