×

Discussion Board

Results 1 to 6 of 6

Thread: DATEFIELD TIME

  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    29

    Question DATEFIELD TIME

    Hello everyone

    I have a small problem with a DateField.

    I work with NetBeans 6.8 and the SDK for the Nokia 6212.

    I created a visual midlet with two textfield and a DateField.

    I'd like to know how I can retrieve the time I entered the DateField to store it in a variable?

    Thank you!

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: DATEFIELD TIME

    Well, that's quite simple.

    Code:
    Date d = myDateField.getDate();
    The complicated bit: there is no difference between a date or a time. You always get both. If you set te DateField to TIME mode, you will get a time, with the date of 1st January 1970.

    If you want the time in milliseconds (from midnight):

    Code:
    long time = myDateField().getDate().getTime();
    Graham.

  3. #3
    Registered User
    Join Date
    Jan 2010
    Posts
    29

    Re: DATEFIELD TIME

    Quote Originally Posted by grahamhughes View Post
    Well, that's quite simple.

    Code:
    Date d = myDateField.getDate();
    The complicated bit: there is no difference between a date or a time. You always get both. If you set te DateField to TIME mode, you will get a time, with the date of 1st January 1970.

    If you want the time in milliseconds (from midnight):

    Code:
    long time = myDateField().getDate().getTime();
    Graham.
    I just found the same method!

    but thank you very much.

    Indeed with the date I Thu Jan 01 10:50:00 (example) GMT 1970.

    but with the other method I return a value in milliseconds but with a lag of 2 hours. if I enter 12:32, 10:32 I back??

    an idea on this problem?
    EDIT:
    Ahhh is not good, I had miscalculated.

    thank you again for your help!

  4. #4
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: DATEFIELD TIME

    I'm guessing you're in Western Europe?

    12:32 Central European Summer Time is 10:32 GMT, so what you see is correct. Internally, times will always be GMT (or UTC).

    Graham.

  5. #5
    Registered User
    Join Date
    Jan 2010
    Posts
    29

    Re: DATEFIELD TIME

    Quote Originally Posted by grahamhughes View Post
    I'm guessing you're in Western Europe?

    12:32 Central European Summer Time is 10:32 GMT, so what you see is correct. Internally, times will always be GMT (or UTC).

    Graham.
    exact

    I had another quick question:

    when I do a form.append ("hello!"), he shows me well.

    but if I want to delete this line or rewrite it, how do I do?
    I do not go to the next line.

    I tried form.deleteAll but it does not work very well ...

    there is not a solution to a CLEAR screen?

    thank you again

  6. #6
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: DATEFIELD TIME

    deleteAll() is the only way to get rid of everything. If you want to be able to delete one, you need the item number returned from append().

    Code:
    int helloItemNumber = form.append("hello");
    
    form.delete(helloItemNumber);
    If you want to be able to change the contents of an item, create a separate object.

    Code:
    StringItem helloItem = new StringItem(null, "hello");
    form.append(helloItem);
    
    helloItem.setText("welcome!");
    Graham.

Similar Threads

  1. Date / time from Internal GPS on E90 wrong?
    By MainMeat in forum Symbian
    Replies: 5
    Last Post: 2009-01-19, 10:02
  2. Replies: 0
    Last Post: 2008-01-03, 17:58
  3. Problem in Time
    By aamitgupta in forum Symbian
    Replies: 7
    Last Post: 2007-12-21, 16:18
  4. Bizarre calendar/time zone change handling in Nokia 9500
    By noetus in forum General Development Questions
    Replies: 0
    Last Post: 2005-09-19, 19:27
  5. How to get correct time.
    By dzaga in forum Mobile Java General
    Replies: 2
    Last Post: 2003-08-06, 22:03

Posting Permissions

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