Results 1 to 3 of 3
  1. #1
    Haegr is offline Member
    Join Date
    Apr 2010
    Rep Power

    Default Storing Date and Sorting Lists

    I've got an odd issue regarding date and I have no idea why.

    Ok so I'm importing

    Java Code:
    import java.util.Date;
    Java Code:
    Date tempDate = new Date(22,02, 1990);
    And here's what I get output...

    August 11

    Where exactly am I going wrong? I just need the day, month and year stored.

    Not sure on the versions of Java and what not. I'm getting a deprecation error that I am suppressing.

    Now onto my List sorting issue.

    Basically my list is displayed and will be sorted based on the priority variable stored in the class.
    I was going to loop through the list and add the notes based on priority so something like

    if prio == 0

    if prio == 1

    Is there a better way to do this? 0 is high, 1 is medium, 2 is low.

    Now when this is sorted, the index's of my array / list will not be the same as those from my jList. How am I to actually find the index of the selected item relative to my array?

    Thanks for the help.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Voorschoten, the Netherlands
    Blog Entries
    Rep Power


    I bet you didn't read the API documentation for the Date class. Don't just guess what the constructor arguments should mean, read it.

    kind regards,


  3. #3
    Haegr is offline Member
    Join Date
    Apr 2010
    Rep Power


    Sorted the Date issue after actually reading the API.

    Sorted the second issue as well.
    Last edited by Haegr; 04-23-2010 at 03:38 PM. Reason: Fixed Issue

Similar Threads

  1. storing date from servlet to sql server
    By KumbhaniMehul in forum Java Servlet
    Replies: 1
    Last Post: 04-11-2010, 01:01 PM
  2. Storing high score and sorting the array
    By Implode in forum New To Java
    Replies: 8
    Last Post: 09-28-2009, 12:43 AM
  3. Compare date input to database with current date
    By hungleon88 in forum Advanced Java
    Replies: 2
    Last Post: 11-25-2008, 08: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, 08: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, 04:15 PM

Tags for this Thread

Posting Permissions

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