Results 1 to 7 of 7
- 05-22-2010, 08:29 AM #1
Member
- Join Date
- May 2010
- Posts
- 5
- Rep Power
- 0
inserting date in oracle database
Hi,
following is the java code for parsing date
------------------------------------
import java.text.SimpleDateFormat;
String dd = "2006-10-20T1350"
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-m-d'T'HHmm");
Date now = new Date();
sdf.parse( dd );
------------------------------------
iam getting following outptut
Fri Jan 20 13:50:00 GMT+05:30 2006
now i want to insert this date in oracle database column (mark as date)
pls help
- 05-22-2010, 12:40 PM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Where you stuck with?
Did you write a query to insert it? Are you dealing with the current date?
- 05-23-2010, 09:28 AM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,427
- Blog Entries
- 7
- Rep Power
- 17
- 05-23-2010, 02:20 PM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
In formatting I can see that, T1350. Is that formatted in correct way?
- 05-23-2010, 04:26 PM #5
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,427
- Blog Entries
- 7
- Rep Power
- 17
- 05-23-2010, 05:33 PM #6
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Ok then with the testing.
It just print the 2006-10-20T1350 on the console. So?
- 05-23-2010, 06:38 PM #7
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,427
- Blog Entries
- 7
- Rep Power
- 17
Try this:
it definitely doesn't print 'Jan' (as the OP showed) but 'Oct' in the date output on my laptop.Java Code:String dd = "2006-10-20T1350"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HHmm"); Date d= sdf.parse( dd ); System.out.println(d);
kind regards,
Jos
Similar Threads
-
Inserting Multiple Images into oracle database using JDBC
By raihan26 in forum JDBCReplies: 2Last Post: 04-01-2010, 04:35 AM -
Compare date input to database with current date
By hungleon88 in forum Advanced JavaReplies: 2Last Post: 11-25-2008, 08:10 AM -
Inserting current date into a DB table
By Java Tip in forum Java TipReplies: 0Last Post: 02-15-2008, 08:38 AM -
PreparedStatement - inserting date
By Java Tip in forum Java TipReplies: 0Last Post: 02-11-2008, 08:44 AM -
Inserting file in to database
By Java Tip in forum Java TipReplies: 0Last Post: 01-07-2008, 08:39 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks