public static Timestamp toTimestamp(DateTime dt) {
        if (dt == null) {
            return null;
        } else {
            return new Timestamp(dt.getMillis());
        }
    }
public static Timestamp toTimestamp ( DateTime dt ) { if ( dt == null ) { return null ; } else { return new Timestamp ( dt . getMillis ( ) ) ; } }
Null-safe method of converting a DateTime to a Timestamp.
<br>
NOTE: The timestamp also should be in UTC.
@return A UTC DateTime