Incredible Today

Inserting value in SQL Server’s datetime by java.sql.Timstamp

Posted 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/

About these ads

6 Responses to "Inserting value in SQL Server’s datetime by java.sql.Timstamp"

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

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;
}

Hi nitin;

Thanks for your comments.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog Moved to Pakzilla.com

I have moved my blog to my own domain www.Pakzilla.com. I will disable posting comments and going to link all posts to my new blog. For now I will make all updates and reply to your comments there. Please also update your RSS to this feed. http://feeds2.feedburner.com/pakzilla Thank you very much.


AddThis Social Bookmark Button

Networking

Blogosphere

Blog Stats

  • 92,643 hits

Pages

April 2007
M T W T F S S
    Jul »
 1
2345678
9101112131415
16171819202122
23242526272829
30  
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: