Here you can find the source of toSQLTimestamp(DateTime dt)
public static java.sql.Timestamp toSQLTimestamp(DateTime dt)
//package com.java2s; //License from project: Apache License import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.joda.time.LocalDateTime; public class Main { public static java.sql.Timestamp toSQLTimestamp(DateTime dt) { // TODO - confirm this conversion always works, esp. across timezones java.sql.Timestamp ts = (dt == null ? null : new java.sql.Timestamp(dt.getMillis())); return ts; }//from w w w . j a v a2 s. co m public static java.sql.Timestamp toSQLTimestamp(LocalDateTime ldt) { // TODO - confirm this conversion always works, esp. across timezones java.sql.Timestamp ts = (ldt == null ? null : new java.sql.Timestamp(ldt.toDateTime().getMillis())); return ts; } public static DateTime toDateTime(java.sql.Timestamp ts) { // TODO - confirm this conversion always works, esp. across timezones DateTime dt = (ts == null ? null : new DateTime(ts)); return dt; } public static DateTime toDateTime(java.util.Date d) { // TODO - confirm this conversion always works, esp. across timezones DateTime dt = (d == null ? null : new DateTime(d)); return dt; } public static DateTime toDateTime(java.sql.Timestamp ts, String timeZoneID) { // TODO - confirm this conversion always works, esp. across timezones DateTime dt = (ts == null ? null : new DateTime(ts, DateTimeZone.forID(timeZoneID))); return dt; } public static DateTime toDateTime(java.util.Date d, String timeZoneID) { // TODO - confirm this conversion always works, esp. across timezones DateTime dt = (d == null ? null : new DateTime(d, DateTimeZone.forID(timeZoneID))); return dt; } }