File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Assigning value of one timestamp to another Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Assigning value of one timestamp to another" Watch "Assigning value of one timestamp to another" New topic
Author

Assigning value of one timestamp to another

devaki hanumante
Greenhorn

Joined: Jan 18, 2009
Posts: 13
I want to assign the value of one timestamp to another in java.
eg:
Timestamp1=timestamp2;

now after that i write the following piece of code
t1.setHours(00);
t1.setMinutes(00);

as a result of this even timestamp2 is getting changed.
is this because they both point to the same object..how do i assign the value of timestamp2 to timestamp1?
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3737
    
  16
devaki hanumante wrote:is this because they both point to the same object

yes
devaki hanumante wrote:how do i assign the value of timestamp2 to timestamp1?

You will need to create a new instance of Timestamp that has the same value as the original instance. Using the clone method is probably the easiest way to do this.

Joanne
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Assigning value of one timestamp to another