Meaningless Drivel is fun!
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: 14957

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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: "Date" Problem
It's not a secret anymore!