Mar 5, 2004 #1 dshaw21369 Programmer Joined Jul 8, 2002 Messages 64 How do I convert java.lang.string Date to java.util.Date using the format YYMMDD?
Mar 5, 2004 #2 sedj Programmer Joined Aug 6, 2002 Messages 5,610 http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html Upvote 0 Downvote
Mar 5, 2004 #3 grega Programmer Joined Feb 2, 2000 Messages 932 Location GB Use SimpleDateFormat Code: DateFormat f = new SimpleDateFormat("yymmdd"); Date d = f.parse("040227"); Greg. Upvote 0 Downvote
Use SimpleDateFormat Code: DateFormat f = new SimpleDateFormat("yymmdd"); Date d = f.parse("040227"); Greg.
Mar 5, 2004 Thread starter #4 dshaw21369 Programmer Joined Jul 8, 2002 Messages 64 I tried the above code yesterday and got java.text.ParseException: Unparseable date: "20040218 Upvote 0 Downvote
Mar 5, 2004 #5 grega Programmer Joined Feb 2, 2000 Messages 932 Location GB Did you set the date format to yyyymmdd? You said your date was in the format yymmdd Greg. Upvote 0 Downvote
Mar 5, 2004 Thread starter #6 dshaw21369 Programmer Joined Jul 8, 2002 Messages 64 I set the format to yyMMdd Upvote 0 Downvote
Mar 5, 2004 #7 grega Programmer Joined Feb 2, 2000 Messages 932 Location GB If you create a SimpleDateFormat of the form yymmdd, you can use it to parse a string with the format yyyymmdd Greg. Upvote 0 Downvote
If you create a SimpleDateFormat of the form yymmdd, you can use it to parse a string with the format yyyymmdd Greg.
Mar 5, 2004 #8 grega Programmer Joined Feb 2, 2000 Messages 932 Location GB Sorry, I mean you can't use it to parse a yyyymmdd date. Greg. Upvote 0 Downvote
Mar 8, 2004 Thread starter #9 dshaw21369 Programmer Joined Jul 8, 2002 Messages 64 I ended up doing the following and it works: java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMdd" ); String sPaymentDueDate = INBOUND; java.util.Date CovertDate = sdf.parse(sPaymentDueDate); outboundsets(CovertDate); Thanks for all your help! Upvote 0 Downvote
I ended up doing the following and it works: java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMdd" ); String sPaymentDueDate = INBOUND; java.util.Date CovertDate = sdf.parse(sPaymentDueDate); outboundsets(CovertDate); Thanks for all your help!