×

Discussion Board

Results 1 to 2 of 2

Thread: only time

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

    Question only time

    Hi everyone.

    Hi have the next code:

    Code:
    dateField1 = new DateField("dateField1", DateField.TIME);
       Date _date =new Date();
       dateField1.setDate(_date);
    but the dateField1 is always empty
    I want the current time, only time
    Anybody can help me?

    Thanks

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

    Re: only time

    In the JavaDocs for the DateField class, it says:

    In TIME input mode the date components of Date object must be set to the "zero epoch" value of January 1, 1970.
    So, you need something like:

    Code:
    private static Date getCurrentTimeOnly() {
        return new Date(System.currentTimeMillis() % (24 * 60 * 60 * 1000L));
    }
    Graham.

Similar Threads

  1. i want to get the GMT time
    By lokesh_kumar_s in forum Symbian
    Replies: 2
    Last Post: 2009-07-29, 17:04
  2. Replies: 7
    Last Post: 2009-07-09, 07:03
  3. user-configured time vs "correct time"
    By tqvisten in forum Mobile Java General
    Replies: 4
    Last Post: 2009-06-17, 13:46
  4. time problem
    By vineet.jain in forum Symbian
    Replies: 2
    Last Post: 2008-09-16, 09:24
  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
  •