I have a SimpleDateFormat object that I retrieve from some internationalization utilities. Parsing dates is all fine and good, but I would like to be able show a formatting hint to my users like "MM/dd/yyyy". Is there a way to get the formatting pattern from a SimpleDateFormat object?
Thanks, I guess I didn't look close enough.
D Lawson
2010-05-03 21:53:28
+1
A:
import java.text.SimpleDateFormat;
public class Sdf {
public static void main( String [] args ) {
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
String patternToUse = sdf.toPattern();
System.out.println( patternToUse );
}
}
OscarRyz
2010-05-03 21:55:07