wood burning stoves*
The moose likes Other JSE/JEE APIs and the fly likes How to grab current date??? 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 » Other JSE/JEE APIs
Reply locked New topic

How to grab current date???

Kishore Dandu
Ranch Hand

Joined: Jul 10, 2001
Posts: 1934
I have used some calender usage etc(using some ones posting from the web)
Following is my code:
Calendar dateCreated = Calendar.getInstance(new Locale("en","US"));
SimpleDateFormat df = new SimpleDateFormat("yyyy");
// apply the format object to the calendar object.
String formattedDate = df.format(dateCreated.getTime());

But it is giving me bad date.
Can some body suggest some thing easier.

SCJP, blog
Rob Ross

Joined: Jan 07, 2002
Posts: 2205
you have already posted this exact same question here
Please post your question only one time and in one forum. Many people read multiple forums and it wastes time and space to have to keep track of multiple answers in different threads.

SCJP 1.4
I agree. Here's the link: http://aspose.com/file-tools
subject: How to grab current date???
Similar Threads
How to get tomorrow's date?
import java.util.date;
Format Date using Calendar
How to grab current date