struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MichaƂ Postupalski <plas...@ncnet.pl>
Subject Re: Error in Prepared Statement in my Struts Action Class
Date Tue, 18 Mar 2003 01:55:41 GMT
On 3/18/2003 2:57 AM, Richard Raquepo wrote:
> Datetime
> i used pstmt.setString(1,fdate.format(now));
> because it does the data does not correctly forms the correct date
> pstmt.setDate(1,now);
> will only save the date (YYYY-MM-DD) but not the
> time...

U should use pstmt.setTimestamp(1, well_formed_field ) because:

"The DATETIME type is used when you need values that contain both date 
and time information. MySQL retrieves and displays DATETIME values in 
'YYYY-MM-DD HH:MM:SS' format."

So try this way:
pstmt.setTimestamp(1,now);


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message