Using Timestamp

I have a column in one of my tables that requires me to give it a Timestamp value when the record is updated. How is it that I use Timestamp() and furthermore, how is it that I can then use toString() so that I can use it in my JDBC SQL statement?

Could someone please give me some sample code that will grab the current date and time in this format:

yyyy-mm-dd hh:mm:ss.000

and then change it into a string that I can use in my SQL statement.

Thank you in advance!

[503 byte] By [moined_mogul] at [2007-9-26 1:42:03]
# 1

How is it that you use Timestamp? I don't know how you do it, but I do it like this:

Timestamp t = rs.getTimestamp("Schedule");

String s = t.toString();

Is that what you meant? And for the second question, since Timestamp is a subclass of java.util.Date, you can use a SimpleDateFormat to format it any way you like. I won't go into details there, if you scan the forums for SimpleDateFormat you'll find anything you don't already know about it.

DrClap at 2007-6-29 2:34:24 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...