Link to home
Start Free TrialLog in
Avatar of pothios
pothios

asked on

Time Stamp help please :(

hi, yesterday i manage to solve my timestamp problem but it seems like its not working again :/
i keep getting 43672 for the diff :(

Timestamp convertedDate = new java.sql.Timestamp(tmgr.getRecordDate(sql).getTime());
long diff;
java.util.Date now;
now = new java.util.Date();
diff = now.getTime() - convertedDate.getTime(); // difference in milliseconds
diff = diff / 1000; // difference in seconds;

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of humanonomics
humanonomics
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@anmalaver, thats fine tmgr.getRecordDate(sql).getTime() will return time in long format, and Timestamp has a constructor that accepts time in long format.What I want to know is what time is stored in database.

The reason being the above code is working absolutely fine for me.

Thanks
@anmalaver

Ignore my comment, I misread you comment. Sorry for that.

:)
SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial