A: 

You create an SQL statement to do so and then call an SQL API to tell the SQL server to execute your statement.

Noah Roberts
I will rephrase my question. I have a string datetime as captioned above and I have a mysql table called records. I want to insert this datetime into records. For arguendo, records has two fields int(id) and datetime(pub_date). Now, data insertion is normally done using sql statement, e.g.: <pre><code> string sql = "insert into records (id,pub_date) values ("+id+",'"+datetime+"'"; </pre></code> Now the problem is datetime is not in correct format. I am assuming the string datetime has to be converted into unix timestamp before I insert the date into my table. If so, how do I do this?
Azeem Michael
+1  A: 

First, you've got an sql-injection attack waiting to happen. Had to be said.

Ok, that huge problem swept aside, you can either convert the date to a MySQL format (such as a UTC timestamp then converted again with FROM_UNIXTIME()), or tell MySQL how to convert it using STR_TO_DATE(). Both are documented in the MySQL manual, under the section "Date and Time Functions".

John