Hello, I have a field of date/time as a part of my sql statement to update the database. I want to convert that field into String and then, use that string in my SQL. This is wut im doing: String m = (new SimpleDateFormat("EEE' 'yyyy-MM-dd' 'HH:mm:ss")).format((java.util.Date) start, new StringBuffer(), new FieldPosition(DateFormat.YEAR_FIELD)).toString(); Is this a right way of converting???..any suggestions or help would be greatly appreciated.
It is difficult to know whether what you are trying to do is correct without seeing the SQL statement. I'd prefer to use a PreparedStatement rather than do all the datetime formatting that you are doing as I feel it is more readable. i.e.
Andy Bowes<br />SCJP, SCWCD<br />I like deadlines, I love the whoosing noise they make as they go flying past - Douglas Adams
Joined: Jun 16, 2003
hello, my sql statement looks like this: update = "UPDATE vippass SET start = \"" + m + "\", email=\"" + email + "\" WHERE passcode=\"" + passcode + "\"";
Joined: Jan 14, 2003
Hi Sam, In that case I would rewrite your UPDATE statement as: