×

Discussion Board

Results 1 to 6 of 6

Thread: convert to time

  1. #1
    Regular Contributor
    Join Date
    May 2008
    Posts
    52

    convert to time

    hi all
    i have string "10-10-2009"
    i want convert it to time
    how i do it ?

  2. #2
    Regular Contributor
    Join Date
    Mar 2008
    Posts
    198

    Re: convert to time

    Quote Originally Posted by eya360 View Post
    i have string "10-10-2009"
    i want convert it to time
    You have to parse the string yourself. Extract the Day, Month and Year values and convert them to int. Then you can use the Calendar class and the setField() method to initialise a Calendar instance with these values.

    You can then use getTime() or getTimeInMillis() whichever you prefer.

    - Mike
    NAVTEQ Network for Developers
    The community for developing innovative location-based applications
    http://NN4D.com

  3. #3
    Regular Contributor
    Join Date
    May 2008
    Posts
    52

    Re: convert to time

    how i use Calendar class for convert ?
    i not found setField() method

  4. #4
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    106

    Re: convert to time

    Quote Originally Posted by eya360 View Post
    how i use Calendar class for convert ?
    i not found setField() method
    Code:
    Calendar calendar = Calendar.getInstance();
    calendar.set(Calendar.YEAR, 2009);
    calendar.set(Calendar.MONTH, 3);
    ...

  5. #5
    Regular Contributor
    Join Date
    May 2008
    Posts
    52

    Re: convert to time


  6. #6
    Regular Contributor
    Join Date
    May 2008
    Posts
    52

    Re: convert to time

    thanks for all
    iam very happy

Similar Threads

  1. Replies: 0
    Last Post: 2008-01-03, 17:58

Posting Permissions

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