java me - How to create a field of format dd/yyyy? -
the field datefield instead value month , year '05/2011' : how create such field ?
in java-me, can use java.util.calendar package formatting date.
here snippet tutorial on displaying date , time in java me:
private void outputdateusingcalendar(date date) { calendar calendar = calendar.getinstance(); calendar.settime(date); stringbuffer sb = new stringbuffer(); int day = calendar.get(calendar.day_of_month); sb.append(numbertostring(day)); sb.append("-"); int month = calendar.get(calendar.month) + 1; sb.append(numbertostring(month)); sb.append("-"); sb.append(calendar.get(calendar.year)); stringitem item = new stringitem("using calendar", sb.tostring()); mainform.append(item); }
Comments
Post a Comment