Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: What's wrong with my date getter?

  1. #1
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Question What's wrong with my date getter?

    I don't have the code with me right now, but I had it try to change the date into DayOfWeek Month DayOfMonth, Year

    and put that on a JMenuBar as the text for a JMenu, but it's saying

    Saturday March (I can't recall), 1

    This was in that file that was giving me trouble. But I'm redoing it now in steps.

    It always being Saturday mgiht be that I did make it on a Saturday and maybe it's never updated since that day. However, that was in November, not March. And why is it getting the year wrong?

    Is it because I put it in a JMenu?


  2. #2
    Member
    Join Date
    Nov 2010
    Location
    New Zealand
    Posts
    32
    Thanks
    3
    Thanked 4 Times in 4 Posts

    Default Re: What's wrong with my date getter?

    Quote Originally Posted by javapenguin View Post
    I don't have the code with me right now, but I had it try to change the date into DayOfWeek Month DayOfMonth, Year

    and put that on a JMenuBar as the text for a JMenu, but it's saying

    Saturday March (I can't recall), 1

    This was in that file that was giving me trouble. But I'm redoing it now in steps.

    It always being Saturday mgiht be that I did make it on a Saturday and maybe it's never updated since that day. However, that was in November, not March. And why is it getting the year wrong?

    Is it because I put it in a JMenu?
    I'm guessing here, but I remember vaguely some weird date old computers used as a reference date for all dates. If you didn't intialize the date properly, you would get a very old date. That wasn't in Java though, and probably in an older version of Windows (or even DOS).

    Have you tried outputting the date to the console or to a file before transformation?


    Edit: Oops, I found what this old date thing was. It's on Apple computers. Apparently they have some numeric variable that holds the seconds since the first of January 1970.
    Last edited by Alice; December 8th, 2010 at 07:43 PM.

  3. The Following User Says Thank You to Alice For This Useful Post:

    javapenguin (December 8th, 2010)

  4. #3
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Post Re: What's wrong with my date getter?

    I did print it out. However, I only printed out the text I set it to.

    Never tried to see if putting it in the JMenu was corrupting it.

    However, what could be the problem?


  5. #4
    Member
    Join Date
    Nov 2010
    Location
    New Zealand
    Posts
    32
    Thanks
    3
    Thanked 4 Times in 4 Posts

    Default Re: What's wrong with my date getter?

    Quote Originally Posted by javapenguin View Post
    I did print it out. However, I only printed out the text I set it to.

    Never tried to see if putting it in the JMenu was corrupting it.
    Well, first thing is to find out where the problem occurs. Try to add a simple System.out.println(...) statement at different spots to do basic debugging.

    However, what could be the problem?
    You have to know that I am not very good at Java. I'm making some suggestions but at some point I won't be able to help any further.

    I doubt it has anything to do with the JMenuBar. That should take standard text.

  6. The Following User Says Thank You to Alice For This Useful Post:

    javapenguin (December 8th, 2010)

Similar Threads

  1. Editing a date
    By waterjames in forum Java Theory & Questions
    Replies: 0
    Last Post: November 27th, 2010, 02:00 PM
  2. Calendar date
    By joshft91 in forum Object Oriented Programming
    Replies: 11
    Last Post: November 6th, 2010, 02:47 AM
  3. DATE.java!
    By hiimjoey11 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 3rd, 2010, 05:37 PM
  4. Declaring a date
    By Akim827 in forum Java Theory & Questions
    Replies: 7
    Last Post: October 12th, 2010, 11:47 AM
  5. sql date problem
    By realosso in forum JDBC & Databases
    Replies: 2
    Last Post: June 3rd, 2010, 08:32 AM