Why does my J2ME DateField not display the correct date?
Posted
by olly
on Stack Overflow
See other posts from Stack Overflow
or by olly
Published on 2009-04-06T15:34:23Z
Indexed on
2010/03/22
1:01 UTC
Read the original article
Hit count: 457
I am storing values and date values in a record store. I have my date field set up like this:
StartDate = new DateField("Start Date ", DateField.DATE);
cal1 = Calendar.getInstance();
cal1.set(Calendar.YEAR, 2009);
cal1.set(Calendar.MONTH, 0);
cal1.set(Calendar.DAY_OF_MONTH, 1);
StartDate.setDate(cal1.getTime());
and I save the date as a string as follows:
strStartDate = cal1.get(cal1.DAY_OF_MONTH) + "/" +
(cal1.get(cal1.MONTH) + 1) + "/" +
cal1.get(cal1.YEAR);
String detailsToAdd = strStartDate
(I have shortened the code.) Now, I want to be able to edit the date at a future stage. However, I need the code to be able to do this. So far I have:
EStartDate = new DateField("Start Date ", DateField.DATE);
I had to change the name of the DateField
box as this was conflicting with other things.
I basically need to be able to show the selected record's date attribute. I currently have the other information displayed. I just need to be able to show the correct date. When I run the program the date field says <date>
.
Any help will be nice
© Stack Overflow or respective owner