質問

it is possible to get the current system date of oracle database using this query,

SELECT sysdate FROM dual;

select (sysdate - to_date('1970-01-01 00:00:00','YYYY-MM-DD HH24:MI:SS')) * 86400 unix_ts from dual;

which returns 19-DEC-12 and 1355949236.999999999999999999999999999998 format respectively.

what if i need it to get it from java perspective and in unix_time format?

1) what is the library name?

e.g.:

import java.util.Date;
import java.text.SimpleDateFormat;
import java.text.DateFormat;
import com.portal.pcm.fields.TmFldRefundIndLastModDate;

2) how to call it?

e.g.:

if(sysdate >= a_date_which_is_in_unix_time_format){...}

Thank you.

役に立ちましたか?

解決

I think you want:

long seconds = new java.util.Date().getTime() / 1000;

See the docs for Date#getTime()

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top