permaculture playing cards*
The moose likes Beginning Java and the fly likes Question on Creation of a Date Object 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 "Question on Creation of a Date Object" Watch "Question on Creation of a Date Object" New topic

Question on Creation of a Date Object

Robert Young

Joined: Jun 09, 2003
Posts: 4
I can create a date object with todays date, but how do you create a Date object with a date other than todays Date?
Richard Jensen
Ranch Hand

Joined: May 14, 2003
Posts: 67

N 37 33 W 122 18
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
You should familiarize yourself with the Java API docs. They can easily answer this question. For example, I first looked at the Date class (which I found by navigating to the java.util package in the upper left corner at the first link, the API docs).
The constructors that do what you want (at least with the ease that you wish) have been deprecated, but they tell you to check the GregorianCalendar class.
I'll let you browse this last link on your own. Notice that all of the above class documents give links to related classes as well as internal links that help you navigate the given class' docs.
The Java API docs are an indespensible tool in learning how to use the standard Java classes. In fact, many third-party classes are distributed with documentation in the exact format. If you can learn how to navigate the API docs, you will be a long way towards mastering the tools at your disposal.

Java API Documentation
The Java Tutorial
Robert Young

Joined: Jun 09, 2003
Posts: 4
Thank you both, that was very helpfull.
I agree. Here's the link:
subject: Question on Creation of a Date Object
Similar Threads
how do I find date difference in months
How to generate FileID and Date?
Date Formatting
Dates comparison with Calendar