Incredible Today

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

Posted by: Tahir Akram on: April 8, 2007

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

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

  • 54,060 hits

My Twitter updates

  • Any music to recommend me people.... 12 minutes ago
  • Internet is back at home thank God. Chawal PTCL guys aye o late per ho tusi great. 27 minutes ago
  • Jagu Pakistan :) its 6:00 AM PKT 1 day ago
  • Just need to go out to have some fresh air. Need to stretch my fingers... 1 day ago
  • I found Opera 9.64 the most pathetic web browser for this internet age. Wave didnt work. FB page refresh req. bad tab browsing. 1 day ago

Pages

 

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