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

    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;
    Constructing
    Java Code:
    Date tempDate = new Date(22,02, 1990);
    And here's what I get output...

    Thursday
    August 11
    00:00:00
    BST
    1927

    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
    tempList.add[x]

    if prio == 1
    tempList.add[x]

    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
    Location
    Voorschoten, the Netherlands
    Posts
    13,773
    Blog Entries
    7
    Rep Power
    21

    Default

    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,

    Jos

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

    Default

    Sorted the Date issue after actually reading the API.

    Sorted the second issue as well.
    Last edited by Haegr; 04-23-2010 at 04: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, 02:01 PM
  2. Storing high score and sorting the array
    By Implode in forum New To Java
    Replies: 8
    Last Post: 09-28-2009, 01:43 AM
  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

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
  •