Results 1 to 5 of 5

Thread: JComboBox Date

  1. #1
    idi
    idi is offline Member
    Join Date
    Feb 2010
    Posts
    5
    Rep Power
    0

    Default JComboBox Date

    I have 3 ComboBox's. 1 for the date, 1 for the month and 1 for the year. Once the user has selected thier DOB using them, i get the selected item from each of the boxes by using the .getSeletedItem method. However i want to be able to join all the values together so i can save it as a Date type. Can someone please point me in the right direction. Tried searching for ages but i cant find nothing.
    thanks

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    One possible way: use your data to create a String representation of the date, and then use SimpleDateFormat to parse the String. Another way, create a GregorianCalendar object with the data and then call getTime() on this object to return a Date object.

  3. #3
    idi
    idi is offline Member
    Join Date
    Feb 2010
    Posts
    5
    Rep Power
    0

    Default

    ok done it now
    thanks
    Last edited by idi; 02-11-2010 at 08:38 PM.

  4. #4
    mikesunshine is offline Member
    Join Date
    Nov 2010
    Posts
    1
    Rep Power
    0

    Default

    could you tell me how you solved it? kind of stuck in the same position! :-)

  5. #5
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,585
    Rep Power
    12

    Default

    It's probably better to start your own thread for your own question but, in any case, did you try either of what Fubarable suggested? What happened?

Similar Threads

  1. Replies: 2
    Last Post: 12-10-2009, 02:58 PM
  2. julian date to full date format
    By judy318 in forum New To Java
    Replies: 7
    Last Post: 11-02-2009, 01:17 PM
  3. Compare date input to database with current date
    By hungleon88 in forum Advanced Java
    Replies: 2
    Last Post: 11-25-2008, 09:10 AM
  4. Creating a Gregorian Calendar using a Date object gives date - 1
    By prachi_goliwadekar in forum New To Java
    Replies: 1
    Last Post: 05-08-2008, 09:32 PM
  5. Difference between current date and anothe date
    By vijay balusamy in forum New To Java
    Replies: 1
    Last Post: 04-16-2008, 05:15 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
  •