05-05-2012 10:21 AM
Hi there, I'm trying to set my DateField's format but it's not working. Right now I have:
DateField dateField = new DateField("Go to:",System.currentTimeMillis(), DateField.DATE);
dateField.setFormat(DateFormat.DATE_LONG);I get the error "Syntax error on token "setFormat", Identifier expected after this token" on setFormat and "Syntax error on token "DATE_LONG", VariableDeclaratorId expected after this token" on DATE_LONG
05-06-2012 12:10 AM - edited 05-06-2012 12:12 AM
Hi Beenjaminnn,
I am not getting your question more clear.
If you want to fetch the date value. then use this.
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date(System.currentTimeMillis()));
String DateTimeString = dateFormat.format(calendar, new StringBuffer(), null).toString();
If this code help you then, like it.
Pawan
Thanks