This content has been marked as final. Show 5 replies
can you try the below code to get the mlilli seconds:
Date systemJboDate = getOADBTransaction().getCurrentDBDate();
long millis = (long)((oracle.sql.DATE)systemJboDate).timestampValue().getTime();
Thanks for your code , issue is, in my code why there is a cal difference?
Can you pl suggest .
When you subtract date values directly, it gives you the difference in "days" provided date formatting is taken care. You will have to multiple the answer by 24*60*60 to convert it to seconds. See the below sql snippet which gives you a difference of 1 sec. You have use simpleDateFormat to convert the date to a acceptable format, subtract and multiple as needed. Hope this helps.
select (to_date('17-01-2013 09:13:46','DD-MM-RRRR HH24:MI:SS')- to_date('17-01-2013 09:13:45','DD-MM-RRRR HH24:MI:SS'))*(24*60*60) dt from dual
Logic is working fine in sql, but in java its not the same.
Difference of time is coming as 1000 millseconds.
1000 * 24* 60 * 60 = 864000. which is not in seconds
Any others ways specific in java
Edited by: rbojja on Jan 18, 2013 9:32 AM
If you are getting the difference as 1000 milliseconds then the answer is correct. 1000 millisecond is 1 second.