I want to get only the date part of java.util.Date() resetting time to 00.
Let me make it more clear. When I am initializing the date object as
java.util.Date date = new java.util.Date();
I am getting the date object with value as "Thu May 27 12:13:49 IST 2010"
I just want to set the time part of this object to "00:00:00"
I dont want to get the output as String using DateFormat class.
The output should be a java.util.Date object only.
In java.util.Date, setHours, setMinutes and setSeconds functions are deprecated.
What alternative I can use instead of those function?
It might be helpful to realize that java.util.Date is essentially nothing more than a wrapper for a long value that represents the milliseconds that have passed since January 1st 1970.
Formatting that long value as a human readable String is no longer its responsibility. If you look at the documentation of some of its deprecated methods that used to offer this kind of behaviour (toGMTString() / toLocaleString()), you'll find that DateFormat should indeed be used for this purpose. What's your reason for not wanting to use the DateFormat class?
Edit: Oh, nevermind, I misunderstood your question.
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.