|
|
|
Rank: Starting Member
Groups: Registered
Joined: 2/19/2003 Posts: 1 Location: ,
|
I am getting parse exception while I am trying to format the follwing date " 02:09:07 Jan 26, 2002 PST " using java.text.DateFormat class.
It seems Paypal only return "payment_date" in this format . In my Java code I have that field as a Java.util.Date object. How do I convert that as Date object. Even I tried changing that field as String but I could not update in Database (MS SQLServer).
Please somone guide me; how do I do that?.
Thanks in Advance
V Sivakumar
|
|
|
|
|
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 9/16/2002 Posts: 2,960 Location: ,
|
I don't think it's a standard date format so you would need to parse it by hand. Probably best to store it as a string. Patrick Breitenbach PayPal, Inc. Dev Net: https://www.paypal.com/pdn
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 1/9/2003 Posts: 6 Location: ,
|
Hope this helps
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss MMM d, yyyy z"); Date date = sdf.parse("02:09:07 Jan 26, 2002 PST", new java.text.ParsePosition(0)));
Regards vinoth
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 10/20/2005 Posts: 2 Location: ,
|
For us who use other language than English there could be problems with the month parsing. This solves the problem:
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss MMM d, yyyy z", Locale.ENGLISH);
|
|
|
|
Guest
|
YAFVision Theme by Jaben Cargman (Tiny Gecko)Powered by YAF |
YAF © 2003-2009, Yet Another Forum.NETThis page was generated in 0.210 seconds.