05-02-2012 09:09 PM
Hi,
I'd like to create a date field with the day of the week. Currently I can make one with the day of month, month and year but I'd like to have one with the day of the week, day of month, month and year.
Right now I have:
DateField dateField = new DateField("Go to:",System.currentTimeMillis(), DateField.DATE);Can I adapt this to include the day of week too?
Ben
05-02-2012 11:56 PM
05-03-2012 04:24 AM
Hi,
Check out the setFormat function with the DateFormat API:
and :
http://www.blackberry.com/developers/docs/5.0.0api
E.
05-03-2012 01:12 PM
So something like this?
DateField dateField = new DateField("Go to:",System.currentTimeMillis(), DateField.DATE);
dateField.setFormat(DateFormat.DATE_LONG);
05-06-2012 01:35 AM
Actually, more like:
dateField.setFormat(DateFormat.getInstance(DateFor
Another option, which I prefer, is:
dateField.setFormat(new SimpleDateFormat("your Date Format Pattern Here"));
The simpleDateFormat class lets you define your own preferred date pattern:
http://www.blackberry.com/developers/docs/5.0.0api
E.
05-13-2012 10:58 AM
Thank you,
But tha still doesn't seem to be working. I'm using Eclipse and it gives me the error
"Syntax error on token "setFormat", Identifier expected after this token"
I used dateField.setFormat(DateFormat.getInstance(DateFor
It seems to be a problem with setFormat, not anything else.