ok, yes this is a homework help question, and no i don't want just the answer. i actually really want to learn this.

Ok, so I have to the simple date format that displays today's date in "week day month day, year)

so here is what i got:

import java.text.*; //for SimpleDateFormat
import java.util.*; // for Date
public class date {
    public static void main(String[] args) {
        date today;
        today= new date();
        [COLOR="Red"]sdf[/COLOR] = new SimpleDateFormat ("EEEE MMMM DD, YYYY");
        System.out.println("Today is" + sdf.format(today));
        /**
         * @param args
         */ 
            // TODO Auto-generated method stub
        }
    }

ok, so it looks pretty good, excpet that stinkin java won't read the "sdf". So i don't know what i am doing wrong with it. Any help or tips would be greatly appriciated.
Remember, i am not looking just for the answer, i really do want to learn this stuff.

Edited 3 Years Ago by Dani: Formatting fixed

...ugh...

ok, so then i got the sdf to work, and then it gave me a warning that the java.util, was never used...so then i fixed that (not really sure how, but the warning went away) and not it won't read the sdf again.

so here is what my code looks like now:

import java.text.*; //for SimpleDateFormat
import java.util.*; // for Date
public class date {
	public static void main(String[] args) {
		date today;
		today= new date();
		today.toString();
		sdf1.format(today);
		sdf1 = new SimpleDateFormat ("EEEE MMMM DD, YYYY");
		System.out.println("Today is" + sdf1.format(today));
		/**
		 * @param args
		 */	
			// TODO Auto-generated method stub
		}
	}

AAHHH, i am about to throw java out the window!!!!! Please help!

SimpleDateFormats will only format Date objects (or classes that extend Date). They won't work on your date class.

ok, so then what do i need to do to fix it? Sorry, I am very new to this, i don't know what i am doing.

"stinkin java won't read the "sdf"" because you haven't "stinkin" declared it properly in any of the code you posted. You would need to do this:

SimpleDateFormat  sdf = new SimpleDateFormat ("EEEE MMMM DD, YYYY");

and even then, masijade's right - it isn't going to work your class just because you called it "date".

thanks for ya'lls help. I figured out what ya'll were saying and I got it to work! yay me!

Try putting SimpleDateFormat infornt of sdf

SimpleDateFormat sdf = new SimpleDateFormat ("EEEE MMMM DD, YYYY");

Edited 3 Years Ago by happygeek: fixed formatting

Try putting SimpleDateFormat infornt of sdf

SimpleDateFormat sdf = new SimpleDateFormat ("EEEE MMMM DD, YYYY");

Well,

1. That's already been said.
2. The OP has declared the problem solved.
3. You didn't notice that today was declared today=new date() rather than today=new Date() .

Well,

1. That's already been said.
2. The OP has declared the problem solved.
3. You didn't notice that today was declared today=new date() rather than today=new Date() .

And

4. This thread is 15 days old. Try to solve more current threads

This question has already been answered. Start a new discussion instead.