This J2ME tip illustrates how To use Date Field. A DateField is an editable component for presenting date and time (calendar) information that may be placed into a Form. Instance of a DateField can be configured to accept date or time information or both of them. This input mode configuration is done by DATE, TIME or DATE_TIME static fields of this class. The getDate() method returns date value of datefield.

 public class DateFieldDemo extends MIDlet implements CommandListener
{
  
  private Display display;
  private Command exit;
  Form frm;
  private DateField date;
  
  public DateFieldDemo()
  {
    //create a DateField 
    date =new DateField("DoB",DateField.DATE);
     display = Display.getDisplay(this);  
  }
  public void startApp()
  {
    frm=new Form("DateField Demo");
    exit= new Command("Exit",Command.EXIT,1);
    frm.addCommand(exit);
    frm.setCommandListener(this);
    //Add DateField to displayable
    frm.setTicker(date);
    
    frm.append("#####");
    display.setCurrent(frm);
  }
  public void pauseApp()
  {
    
  }
  public void destroyApp(boolean un)
  {
  }
  public void commandAction(Command cmd,Displayable d)
  {
    if(cmd==exit){    
      
    }
  }
  
}