mercredi 1 juillet 2015

How to add current time in previous date in java?

I was trying to add current time into previous date. But it was adding in current date with time not with previous date.

see my bellow code:

Date startUserDate = ;//this is my previous date object;
startUserDate.setTime(new Date().getTime());// here i'm trying to add current time in previous date.
System.out.println("current time with previous Date :"+startUserDate);

In previous date there is no time and i want to add current time in previous date.I can do this, please help me out.

Aucun commentaire:

Enregistrer un commentaire