Discussion Board

Results 1 to 6 of 6

Thread: convert to time

  1. #1
    Regular Contributor eya360's Avatar
    Join Date
    May 2008
    Posts
    52
    hi all
    i have string "10-10-2009"
    i want convert it to time
    how i do it ?

  2. #2
    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 eya360's Avatar
    Join Date
    May 2008
    Posts
    52
    how i use Calendar class for convert ?
    i not found setField() method

  4. #4
    Regular Contributor Unit1ed's Avatar
    Join Date
    Dec 2008
    Posts
    106
    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 eya360's Avatar
    Join Date
    May 2008
    Posts
    52

  6. #6
    Regular Contributor eya360's Avatar
    Join Date
    May 2008
    Posts
    52
    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
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved