Jump to content


Photo

Formating Date


  • This topic is locked This topic is locked
3 replies to this topic

#1 vsiva

vsiva

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 19 February 2003 - 04:27 AM

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


#2 paypal_pb

paypal_pb

    Advanced Member

  • Members
  • 2,960 posts

Posted 19 February 2003 - 11:26 AM

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

#3 vinoth

vinoth

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 19 February 2003 - 09:53 PM

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

#4 magnus

magnus

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 20 October 2005 - 01:33 AM

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);




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users