This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Help with DateFormat!? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help with DateFormat!?" Watch "Help with DateFormat!?" New topic

Help with DateFormat!?

Kriss Masters

Joined: Nov 17, 2003
Posts: 5
Why can't i compile this code?
SimpleDateFormat dayformat = new SimpleDateFormat("yyyy.MMM.dd");
GregorianCalendar day = new GregorianCalendar();
String now =dagformat.format(day);
/ kriss
Joel McNary

Joined: Aug 20, 2001
Posts: 1817

What error are you getting? Chances are, if you read the error message, you will know what's wrong (javac is usually pretty good at telling you what's wrong....)

If you take a look, you will see that it doesn't know what "dagformat" is. This is correct. The variable that you have is "dayformat"

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
I agree. Here's the link:
subject: Help with DateFormat!?
Similar Threads
converting date string into Calendar.Day of Year
Date query
Problem with GregorianCalendar
Date formatting
newbie needs to know how do get todays date