Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-17-2008, 11:02 PM
Member
 
Join Date: Aug 2008
Posts: 39
hungleon88 is on a distinguished road
get Trouble with SetDate
hi every body , i have some trouble, please help and hitn me solve this,thanks!


First : I can use method setDate() of prepareStatement
this is my code: java.util.Date date = new java.util.Date();
java.sql.Date sqlDate = new java.sql.Date(date.getTime());
preStatement.setDate(sqlDate);



Second : When i use this code :
java.util.Date date = new java.util.Date();
java.sql.Date sqlDate = new java.sql.Date(date.getTime());
String str = sqlDate.toString();
preStatement.setDate(str);
In database will have record like this : Sep 18 2008 12:00 AM
It's always 12:00 AM (Month, Day, year are right, only the time make me mad , it cannot get the current time)


Thanks for read my post!
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble maximizing tab dragonwitch New To Java 2 09-12-2008 08:24 PM
having some trouble Unknown1369 New To Java 13 07-22-2008 01:52 AM
Trouble in Runing kavithaprabhaker New To Java 5 05-13-2008 07:59 AM
Compile Trouble adelgado0723 New To Java 5 04-21-2008 04:02 AM
trouble with program jimJohnson New To Java 1 04-03-2008 11:29 AM


All times are GMT +3. The time now is 02:27 PM.


VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org