Here's my code:
Date aux = new Date();
TextField txtFecha = new TextField("Fecha:", aux.toString(dd/mon/yyyy), 50, TextField.ANY);
I'm trying to get my date to format like: "20/4/2010"
Thank you!
Here's my code:
Date aux = new Date();
TextField txtFecha = new TextField("Fecha:", aux.toString(dd/mon/yyyy), 50, TextField.ANY);
I'm trying to get my date to format like: "20/4/2010"
Thank you!
You'll have to use java.util.Calendar and parse it by hand on your own. There are no library classes to help you out.
Date today = new Date();
Calendar calendar = Calendar.getInstance();
calendar.set(today);
int month = calendar.get(Calendar.MONTH) + 1; // Java months start with Jan = 0,..., Dec = 11
int day = calendar.get(Calendar.DATE);
int year = calendar.get(Calendar.YEAR);
String dateStr = day + "/" + month + "/" + year;