Convert between long(java) and Date(Oracle):
Do you need to convert between Date in oracle and long in java, you can use the following technique to achive that.
To convert from long value to Date:
oracle_date date := (in__date / (24 * 60 * 60 * 1000)) + to_date('01/01/1970','mm/dd/yyyy');
To convert from Date to long value:
long_date date := (in__date - to_date('01/01/1970','mm/dd/yyyy') ) * (24 * 60 * 60 * 1000);
Do you need to convert between Date in oracle and long in java, you can use the following technique to achive that.
To convert from long value to Date:
oracle_date date := (in__date / (24 * 60 * 60 * 1000)) + to_date('01/01/1970','mm/dd/yyyy');
To convert from Date to long value:
long_date date := (in__date - to_date('01/01/1970','mm/dd/yyyy') ) * (24 * 60 * 60 * 1000);
No comments:
Post a Comment