Posts

Showing posts from March, 2007

Unix timestamp to oracle date

FUNCTION unixtimestampToDate( in_Date IN number )
RETURN DATE IS
BEGIN
RETURN to_date('01-jan-1970', 'dd-mon-yyyy')+ (in_Date / ( 60*60*24) -
(5/24)) ;
END ;

FUNCTION DateToUNIXTimestamp( in_Date IN DATE )
RETURN NUMBER IS
BEGIN
RETURN TRUNC( ( in_Date - TO_DATE( '01-jan-1970', 'dd-mon-yyyy' ))
* 60 * 60 * 24 +(5/24) * 60 * 60 * 24) ;
END ;