I am using the Joda-Time library in Java, and have a date and time stored as an org.joda.time.DateTime object.
How can I reliably convert this DateTime object into a String that will be parsed correctly by SQL server (including timezone), such that I can use it in an INSERT SQL statement?
you can try this simple code :
DateTime dt = new DateTime(); DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss"); String dtStr = fmt.print(dt);
2.1m questions
2.1m answers
60 comments
57.0k users