Couple problems:
You're still using varaibles before they're even created. You need to move the date formatting and strings block of codes before displaying the user name and date.
What is String title = datetoday;? datetoday doesn't even exist yet! And it's not a string.
In the line date = myDateFormat.format( today ); The variable today and myDateFormat doesn't even exist yet.
There's a total of 3 variables that are being used that hasn't been intialized yet. And 1 variable that isn't even being used at all
That's from looking at your recent coding.
From your first post:
String date;
Date today;
today = new Date ( );
date = new SimpleDateFormat ( "MM/dd/yy*)
This block of code is better than what you have now. The only problem with it is that the date = new SimpleDateFormat ( "MM/dd/yy*) line is in error. date is already a String type, not a SimpleDateFormat. So, either you change the line String date; to SimpleDateFormat date; or rename the variable date in the line date = new SimpleDateFormat ( "MM/dd/yy*) to something else.
Quote:
another pointer, you may be able to just add the date like you currently have, but check to see if there is a date.toString() function. More than likely there is. Since it is an object, it doesnt necessarily mean it will give you a pretty string when appending it to a String.
|
On the contray, if you use System.out.println(date); it's the same as System.out.println(date.toString());
Read the SimpleDateFormat API. And to get even better marks, I suggest that you should use proper naming conviction