Last active
October 22, 2017 16:42
-
-
Save basti/6634820 to your computer and use it in GitHub Desktop.
Snippet to convert PayPal date format to DateTime (taken from: http://rhnh.net/2008/03/17/paypal-ipn-fails-date-standards)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# taken from: http://rhnh.net/2008/03/17/paypal-ipn-fails-date-standards | |
# parses PayPal non-standard format | |
DateTime.strptime("18:30:30 Jan 1, 2000 PST", "%H:%M:%S %b %e, %Y %Z").new_offset(0) | |
# in Rails you can use to_time_in_current_zone to convert it to TimeWithZone | |
DateTime.strptime("18:30:30 Jan 1, 2000 PST", "%H:%M:%S %b %e, %Y %Z").to_time_in_current_zone |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment