Posted by: Tahir Akram on: April 8, 2007
This post has been moved to: http://www.pakzilla.com/2007/04/08/inserting-value-in-sql-server%e2%80%99s-datetime-by-javasqltimstamp/
Uh….according to the javadoc for java.sql.Timestamp the ToString function returns a String object in yyyy-mm-dd hh:mm:ss.fffffffff format.
So the sqlTime.toString() function should be sufficient, it works for me with mysql.
Silly me, I see now that you are using the java.sql.Time and not Timestamp. I’m so used to seeing Timestamp I just glossed over that part. Good example of how to use the SimpleDateFormat. I never did understand how to use it just by looking at the javadoc.
Muy buen Dato estimado Amigo, estaba teniendo problemas, por que necesitaba conocer fecha y hora de transaccion.
Gracias
I think this code should be enough…
public static Timestamp getTodayTimestamp ()
{
Calendar calendar=Calendar.getInstance();
Timestamp timeStamp = new Timestamp(calendar.getTimeInMillis());
return timeStamp;
}
May 12, 2007 at 1:51 pm
Hi
that works a treat… thanks very much…
dates are a pain … and dates between java and sql are worse…
this code did the business for me thanks