java me - J2ME: Get only year/month/day from DateField -
i'm trying use datefield display year, month or day has been selected in calendar.
public datefield getdatefield() { datefield = new datefield("datefield", datefield.date); datefield.setdate(new java.util.date(system.currenttimemillis())); }
then i'd use code, instead of long date "thu oct 07 00:00:00 gmt+02:00 2010" see month has been selected, "october" or "10" etc.
string month = datefield.getdate().tostring(); system.out.println("selected month: " + month);
i can't find on datefield thing... want short date "2010-10-05" if specific date has been selected in datefield.
calendar cal= calendar.getinstance(); cal.settime(datefield.getdate()); string date = cal.get(calendar.year) + "-" + ( cal.get(calendar.month) + 1 ) + "-" + cal.get(calendar.day_of_month);
Comments
Post a Comment