Add DateField with current time to a form : DateField « J2ME « Java Tutorial

Add DateField with current time to a form
import java.util.Calendar;

import javax.microedition.lcdui.DateField;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.midlet.MIDlet;

public class DateFieldTIME extends MIDlet {
  protected Display display;

  protected void startApp() {
    display = Display.getDisplay(this);

    Form form = new Form("Demo");


    DateField timeOnly = new DateField("Time", DateField.TIME);


  protected void pauseApp() {

  protected void destroyApp(boolean unconditional) {

31.6.1.Add DateField with current time to a formAdd DateField with current time to a form
31.6.2.Create DateField for DateCreate DateField for Date
31.6.3.Create DateField for Date and Time
31.6.4.Use DateFieldUse DateField
31.6.5.Today's date in DateFieldToday's date in DateField