We can do this in following two ways:
1. By using Prepared's method setTimestamp( )
1. By using Prepared's method setTimestamp( )
pstmt.setTimestamp(2, new
Timestamp(System.currentTimeMillis()));
2. Or we can use DB specific calls to set the currect date and time in table.
String ins_into_pub_log="Insert
into trx_pub(trx_id,curr_date,pub_code,sub_code)values(?,current_date,?,?);";
-- Here we used postgreSQl in our program thats why we used current_date, if you are using oracle then you can use SYSDATE.
No comments:
Post a Comment