Results 1 to 1 of 1
  1. #1
    mahdi-farzami is offline Member
    Join Date
    Aug 2009
    Posts
    11
    Rep Power
    0

    Default probleam in getting phone time and date !!!

    Hi , i want to get phone current time and date . i use this code , but time is not true !!! please help me , where in this code is wrong ???
    Java Code:
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    
    import java.util.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    
    /**
     * @author mahdi
     */
    public class Midlet extends MIDlet {
    
        Display display;
        Form form = new Form("Clock");
        Calendar calendar;
    
    
        public void startApp() {
    
            display = Display.getDisplay(this);
            calendar = Calendar.getInstance();
            calendar.setTimeZone(TimeZone.getTimeZone("GTM"));
            form.append(" Year : " + String.valueOf(calendar.get(Calendar.YEAR )) + "\n" );
            form.append(" Month : " + String.valueOf(calendar.get(Calendar.MONTH)) + "\n");
            form.append(" Day : " + String.valueOf(calendar.get(Calendar.DAY_OF_MONTH)) + "\n");
            form.append(" Hour : " + String.valueOf(calendar.get(Calendar.HOUR_OF_DAY)) + "\n");
            form.append(" Minute : " + String.valueOf(calendar.get(Calendar.MINUTE)) + "\n");
            display.setCurrent(form);
    
        }
    
        public void pauseApp() {
        }
    
        public void destroyApp(boolean unconditional) {
        }
    }
    Attached Thumbnails Attached Thumbnails probleam in getting phone time and date !!!-screenshot.jpg  

Similar Threads

  1. Time and Date
    By Manfizy in forum New To Java
    Replies: 0
    Last Post: 05-27-2009, 12:58 PM
  2. Formatting time and date
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-17-2008, 07:35 PM
  3. Date/Time Servlet
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-14-2008, 09:34 AM
  4. Time and Date in Java
    By java_fun2007 in forum New To Java
    Replies: 4
    Last Post: 11-06-2007, 07:25 PM
  5. how to get the current date and time
    By valery in forum New To Java
    Replies: 1
    Last Post: 08-03-2007, 06:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •