File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark ""Date" Problem" Watch ""Date" Problem" New topic

"Date" Problem

Paresh Joshi

Joined: Jul 19, 2007
Posts: 5
i am getting Date object from another Class's method.
now i want to add some days (integer) and wants new Date (only date part)

there are some methods in this class but most of them are Deprecated

is there any way to do this ? , or any way to convert Date object to Calendar

please help !

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15080

Class Calendar has a setTime() method which you can use to set the calendar to the date and time of a Date object:

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Hong Lu

Joined: Aug 13, 2007
Posts: 1
see below

Calendar calendar = Calendar.getInstance();

you may find more useful information in API document.
I agree. Here's the link:
subject: "Date" Problem
It's not a secret anymore!