Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Posts: 49
Registered: ‎05-02-2012
My Device: Bold 9790
My Carrier: Wind Mobile

DateField setFormat not working

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);

 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

Posts: 209
Registered: ‎04-30-2011
My Device: BlackBerry Z10
My Carrier: Airtel

Re: DateField setFormat not working

[ Edited ]

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.