This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Working with postgresql 9.2 DB,need to store and display last login time for each user on login. I am storing login time as timestamp without zone.On each successful login I am updating the last login value in DB table. For fetching the last login value in my Action class execute method(working with struts 1.3.8) in required format, I am using..
select to_char(lastlogin,'HH:MM:SS PM DD-MM-YY') from userdetails where ......
I used PreparedStatement object, Problem is I am getting the same previous value each time for each person(the time when first time preparedstatement object query was parsed). I think to_char() method get executed once and stored its value for preparedstatement object. But using preparedstatement object is must. I want to store value in java.sql.Timestamp object and use some method of java.sql.Timestamp class to format. I have tried, but no luck. Any help?Any idea? Please let me know.