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);
1.4m articles
1.4m replys
5 comments
57.0k users