Welcome!

Welcome to the Official BlackBerry Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Contributor
beenjaminnn
Posts: 42
Registered: ‎05-02-2012
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);
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

Please use plain text.
Developer
pankajace12
Posts: 188
Registered: ‎04-30-2011
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.

Pawan
Thanks 

Please use plain text.