| 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: 3011
|
|
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
|
 |
 |
|
|
subject: Assigning value of one timestamp to another
|
|
|